//Számítógép\HKEY_CLASSES_ROOT\CLSID\{01AD3EBB-8A57-4730-9EED-A6260F99B30D}\InprocServer32 FUNCTION SoraxActivex(aPriv, cPdf, oDlg, nLeft, nTop, nWidthParam, nHeightParam) local osPdf, oSorax local nDocHandle, nPageCount, nWidth, nHeight, nWindowWidth, nWindowHeight, nEvent, mp1, mp2 local nBgLeft, nBgTop, nBgWidth, nBgHeight local lConfigOk, lAttachDoc local aScreen local cDocLabel local laSize local loBg, oTBar local lShowPdf := .T. local lShowIcons := .T. private wlCreateDlg := .not. "O"$ValType(oDlg) public oSpin public wsorax_alapdpi := 100 //Alap‚rtelmezetten ezt a DPI ‚rt‚ket haszn lja public wsorax_iconx := 0 public wsorax_icony := 0 public wsorax_iconw := 0 public wsorax_iconh := 0 public wsorax_da public wsorax public wsorax_size := -3 public wsorax_handtool := 1 //Alap‚rtelmezetten mozgat s m˘d public wViewHandle := 0 public wDocHandle := 0 public wsorax_siglepage := .T. public wsorax_hgap := .F. public wsorax_vgap := .F. public wsorax_pagenumber := 1 public wsorax_pagestep := 1 public wsorax_maxpage := 1 public wsorax_degree := 1 public wsorax_editpage := "1" //Az edit mez‹ben megjelen‹ oldalsz m public wsorax_ready := .F. public sorax_editenter := .F. //‚ppen szerkezti-e az oldal sz m editet, ha igen akkor az oldal sz mra ugr s ne irja fell public wsorax_button := Array(21) public wsorax_normalcolors := {GRA_CLR_PALEGRAY, GRA_CLR_PALEGRAY, GRA_CLR_PALEGRAY} public wSel := GraMakeRGBColor({249, 166, 2}) public wsorax_selectedcolors := { wSel, wSel, wSel} public wsorax_find := .F. public wsorax_istextselected := .F. //XbpApplication():enableVisualStyles := XBPAPP_NOSTYLES if ValType(aPriv)="A" PRIVATE wev := aPriv[1] PRIVATE wkonyvt := aPriv[2] PRIVATE wkonyvtev := aPriv[3] PRIVATE wextra := aPriv[4] PRIVATE pksmodul := aPriv[5] PRIVATE pDesktopSize := aPriv[6] PRIVATE Szin_UzHatter := aPriv[7] PRIVATE Szin_FGbroGet := aPriv[8] PRIVATE Szin_BGbroGet := aPriv[9] PRIVATE Szin_UzSzin := aPriv[10] PRIVATE Be_Adatszin := aPriv[11] PRIVATE Szin_Uzkiemelt:= aPriv[12] PRIVATE wvevo := aPriv[13] PRIVATE wprver := aPriv[14] endif nWidth := 800 nHeight := 600 if wlCreateDlg aScreen := AppDesktop():currentSize() oDlg :=Qs_XbpDialog():new(AppDesktop(),,{aScreen[1]/2.4-nWidth/2, aScreen[2]/2.4-nHeight/2},{nWidth,nHeight},,.F.) oDlg:icon :=1 oDlg:taskList :=.T. oDlg:title := cPdf oDlg:clipSiblings:=.T. oDlg:minButton:=.T. oDlg:maxButton:=.T. oDlg:create() nBgLeft := 0 nBgTop := 712-5 nBgWidth := nWidth+218 nBgHeight := 36 else nBgLeft := nLeft nBgTop := nHeightParam-36 nBgWidth := nWidthParam nBgHeight := 36 endif aPP := { {XBP_PP_BGCLR, GRA_CLR_PALEGRAY} } loBg := XbpStatic():new(oDlg:drawingArea, , {nBgLeft-iif(wlCreateDlg,0,2), nBgTop}, {nBgWidth+iif(wlCreateDlg,0,2), nBgHeight}, aPP) loBg:setCaption("") loBg:create() wsorax_da := loBg if lShowIcons wsorax_iconx := 5+iif(wlCreateDlg,0,2) wsorax_icony := 13-7 //nHeight+116 wsorax_iconw := 32 wsorax_iconh := 32 SoraxSepLineHoriz(0) SoraxSepLineHoriz(wsorax_iconh-4) SoraxAddIcon(1140, "Mozgat s eszk”z", {|| wsorax_handtool := 1, SoraxActiveTool(), SoraxUnSelectButton({2,3}), SoraxSelectButton(1)}, "E", 1) SoraxAddIcon(1139, "Kijel”l‚s eszk”z", {|| wsorax_handtool := 2, SoraxActiveTool(), SoraxUnSelectButton({1,3}), SoraxSelectButton(2)},, 2) SoraxAddIcon(1148, "NagyĄt˘ eszk”z", {|| wsorax_handtool := 4, SoraxActiveTool(), SoraxUnSelectButton({1,2}), SoraxSelectButton(3)},, 3) SoraxSepLine() SoraxAddIcon(1141, "Nyomtat s",{|| wSorax:CallMethod("Print", wViewHandle, 0)} ,, 4) SoraxAddIcon(1129, "Kijel”lt sz”veg m sol sa", {|| iif(!wsorax_istextselected, Uzenet("Sz”veg m sol s hoz el‹sz”r jel”lj”n ki sz”veget ;a kijel”l‹ eszk”zzel (2. ikon)!"), nil), iif(wsorax_istextselected, wSorax:CallMethod("Copy", wViewHandle), nil)},"D",5) SoraxSepLine() SoraxAddIcon(1142, "Lapok vĄzszintes elv laszt sa", {|| wsorax_hgap := .not. wsorax_hgap, SoraxSelectButtonVar(wsorax_hgap,6), SoraxViewLayout(), SoraxShowPage()},,6) SoraxAddIcon(1143, "Lapok fgg‹leges elv laszt sa", {|| wsorax_vgap := .not. wsorax_vgap, SoraxSelectButtonVar(wsorax_vgap,7), SoraxViewLayout(), SoraxShowPage()},"D",7) SoraxSepLine() SoraxAddIcon(1131, "NagyĄt s", {|| SoraxNagyit(), SoraxShowPage() },,8) SoraxAddIcon(1132, "KicsinyĄt‚s", {|| SoraxKicsinyit(), SoraxShowPage() },,9) SoraxAddIcon(1130, "Eredeti m‚ret", {|| wsorax_size := -1, SoraxShowPage() },,10) SoraxAddIcon(1133, "Egy oldal m‚ret‚hez igazĄt s", {|| wsorax_size := -3, SoraxShowPage()},,11) SoraxAddIcon(1134, "Sz‚less‚ghez igazĄt s", {|| wsorax_size := -2, SoraxShowPage() },,12) SoraxSepLine() SoraxAddIcon(1144, "Egy oldalas megjelenĄt‚s", {|| wsorax_pagestep := 1, wsorax_siglepage := .T., SoraxViewLayout(), SoraxShowPage(), SoraxUnSelectButton(14), SoraxSelectButton(13)},"E",13) SoraxAddIcon(1145, "Kett‹ oldalas megjelenĄt‚s", {|| wsorax_pagestep := 2, wsorax_siglepage := .F., SoraxViewLayout(), SoraxShowPage(), SoraxUnSelectButton(13), SoraxSelectButton(14)},,14) SoraxSepLine() SoraxAddIcon(1135, "Els‹ oldal", {|| wsorax_pagenumber := 1, SoraxShowPage()},"D",15) SoraxAddIcon(1136, "El‹z‹ oldal", {|| wsorax_pagenumber -= wsorax_pagestep, SoraxShowPage()},"D",16) oSpin := XbpSLE():new() oSpin:autoTab := .T. oSpin:bufferLength := 5 oSpin:dataLink := {|x| IIf( x==NIL, wsorax_editpage, wsorax_editpage := x ) } oSpin:keyBoard := {| nKeyCode, uNIL, self | SoraxPageChange() } oSpin:create(wsorax_da, , {wsorax_iconx,wsorax_icony}, {42,19} ) oSpin:setData() oSpin:killInputFocus := { |x,y,oSLE| oSLE:getData(), sorax_editenter := .F., SoraxEditRefresh() } wsorax_iconx += 42 SoraxAddIcon(1137, "K”vetkez‹ oldal", {|| wsorax_pagenumber += wsorax_pagestep, SoraxShowPage()},,17) SoraxAddIcon(1138, "Utols˘ oldal", {|| wsorax_pagenumber := wsorax_maxpage, SoraxShowPage()},,18) SoraxSepLine() SoraxAddIcon(1146, "Forgat s balra", {|| SoraxRotate(-90), wsorax:CallMethod("RotateView", wViewHandle, wsorax_degree), SoraxShowPage()},,19) SoraxAddIcon(1147, "Forgat s jobbra", {|| SoraxRotate(90), wsorax:CallMethod("RotateView", wViewHandle, wsorax_degree), SoraxShowPage()},,20) SoraxAddIcon(1147, "Forgat s jobbra", {|| wsorax_find := .T., wsorax:CallMethod("Find", wViewHandle) },,21) //Icon for Search, the Search crash. endif if wlCreateDlg wsorax_left := 0 wsorax_top := 25+7 wsorax_width := 1019 wsorax_height := 739 else wsorax_left := nLeft wsorax_top := nTop + 47 - 11 wsorax_width := nWidthParam + nLeft wsorax_height := nTop + nHeightParam endif oSorax := XbpActiveXControl():new(oDlg:drawingArea, ,{wsorax_left,wsorax_top},{wsorax_width,wsorax_height}, , .F.) oSorax:CLSID := "Sorax.Pdf Control.2" oSorax:create(,,,,,.F. ) wsorax := oSorax objektum_kiiro("activex.txt", oSorax, .F.) if lShowPdf lConfigOk := oSorax:CallMethod("ResetConfig", ".\\SPdf.ini") wDocHandle := oSorax:CallMethod("OpenDoc", cPdf, "", "") wViewHandle := oSorax:CallMethod("CreateView", wsorax_left, wsorax_top, wsorax_width, wsorax_height, oDlg:drawingArea:getHWND(), 100) lAttachDoc := oSorax:CallMethod("AttachDoc", wViewHandle, wDocHandle) SoraxActiveTool() wsorax_maxpage := oSorax:CallMethod("GetPageCount", wDocHandle) oSorax:subscribeEvent( wsorax:isEventPublished("PageChanged"), {|n| SoraxOnPageChanged(n) } ) oSorax:subscribeEvent( wsorax:isEventPublished("SelectionChanged") , {|lSelect| SoraxOnSelectionChanged(lSelect) } ) oSorax:subscribeEvent( wsorax:isEventPublished("Searching") , {|nPage, bBool| memowrit(progdir+"search.txt", "KERES") } ) SoraxRotate(90) wsorax:CallMethod("RotateView", wViewHandle, wsorax_degree) SoraxRotate(90) wsorax:CallMethod("RotateView", wViewHandle, wsorax_degree) SoraxViewLayout() SoraxShowPage() endif if wlCreateDlg oDlg:show() oDlg:eventloop() oDlg:destroy() endif /*nEvent := 0 DO WHILE nEvent <> xbeP_Close nEvent := AppEvent( @mp1, @mp2, @oDlg ) //strtofile(Time() + iif(wsorax_find, "(FIND)", " ") + " : " + dc_xtoc(nEvent) + " // " + dc_xtoc(mp1, .T.) + " // " + dc_xtoc(mp2, .T.) + CRLF, progdir+"EventLog.txt" ,"APP") oDlg:handleEvent( nEvent, mp1, mp2 ) ENDDO */ RETURN nil FUNCTION SoraxOnSelectionChanged(lSelect) wsorax_istextselected := lSelect SoraxEnableButtonVar(lSelect, 5) RETURN nil FUNCTION SoraxEditRefresh() wsorax_editpage := aStr(wsorax_pagenumber) oSpin:setData() RETURN nil FUNCTION SoraxOnPageChanged(nPage) if !sorax_editenter .and. wsorax_ready //Csak akkor irja fell az oldal sz m edit mez‹t ha ‚ppen nincs benne a user wsorax_pagenumber := nPage wsorax_editpage := aStr(nPage) oSpin:setData() SoraxDisableButtonVar(nPage=1, 15) SoraxDisableButtonVar(nPage=1, 16) SoraxDisableButtonVar(nPage=wsorax_maxpage, 17) SoraxDisableButtonVar(nPage=wsorax_maxpage, 18) endif RETURN nil FUNCTION SoraxPageChange() local nPage sorax_editenter := .T. nPage := ValTry(oSpin:getData(),,-1) if nPage>-1 .and. nPage <> wsorax_pagenumber .and. wsorax_ready .and. !Empty(oSpin:getData()) wsorax_editpage := oSpin:getData() if nPage>wsorax_maxpage nPage := wsorax_maxpage endif if nPage<1 nPage := 1 endif wsorax_pagenumber := nPage SoraxShowPage() endif RETURN nil FUNCTION SoraxRotate(nDegree) wsorax_degree += nDegree if wsorax_degree <0 wsorax_degree := 270 elseif wsorax_degree>270 wsorax_degree := 0 end RETURN nil FUNCTION SoraxActiveTool() wSorax:CallMethod("SetActiveTool", wViewHandle, wsorax_handtool) RETURN nil //oSorax:CallMethod("SetViewMode", nViewHandle, 2) //2:fullscreen FUNCTION SoraxViewLayout() if wsorax_siglepage //Tiltani kell a lapok fgg‹leges elv laszt sa gombot SoraxDisableButton(7) else SoraxEnableButton(7) endif wSorax:CallMethod("SetViewLayout", wViewHandle, iif(wsorax_siglepage, 1, 2)+4+iif(wsorax_hgap, 16, 0)+iif(wsorax_vgap, 32, 0)) //singlepage, 4:continous RETURN nil FUNCTION SoraxShowPage(nPage) default nPage := 1 if wsorax_pagenumber<1 wsorax_pagenumber := 1 end wSorax:CallMethod("ShowPage", wViewHandle, wsorax_pagenumber, wsorax_size) //96, -2 old wsorax_ready := .T. RETURN nil FUNCTION SoraxKicsinyit() if wsorax_size<0 wsorax_size := wsorax_alapdpi else wsorax_size := Int(wsorax_size/1.5) endif RETURN nil FUNCTION SoraxNagyit() if wsorax_size<0 wsorax_size := wsorax_alapdpi else wsorax_size := Int(wsorax_size*1.5) endif RETURN nil