diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-06 11:09:14 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-06 11:09:14 +0000 |
commit | bac89d12c2d2bd794009be7d831e06d456f8b49b (patch) | |
tree | 324afac8762644df9b086c8742b14f229875b004 /toolkit/workben/layout | |
parent | 6ba3bd2d5d02a6b15b66763aa0c969957e14965d (diff) |
INTEGRATION: CWS layout_DEV300 (1.1.2); FILE ADDED
2008/02/08 18:44:47 jcn 1.1.2.1: Initial toolkit import from ee9a2fcc29d7e2f01cc80ef7c13bf7bc7d55ae7e.
layout/source/awt -> toolkit/source/awt
layout/source/core -> toolkit/source/layout
layout/source/wrapper -> toolkit/source/vclcompat
layout/inc/layout -> toolkit/inc/layout
layout/source/inc -> toolkit/inc/layout
layout/workben -> toolkit/workben/layout
That's ooo-build trunk r11539 @ ooh680-m5/src680-m245.
Diffstat (limited to 'toolkit/workben/layout')
21 files changed, 1390 insertions, 0 deletions
diff --git a/toolkit/workben/layout/sequence.xml b/toolkit/workben/layout/sequence.xml new file mode 100644 index 000000000000..e89db54db2dc --- /dev/null +++ b/toolkit/workben/layout/sequence.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<framewindow xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + xmlns:style="http://openoffice.org/2007/layout/style" + title="Sequence Test" style:optimumsize="true" + style:has_border="true" style:sizeable="true" style:moveable="true"> + <vbox> + <multilistbox linecount="5" string-item-list=":a:b::c:::d::::e:as:" + selected-items="0:1" /> + <okbutton cnt:expand="false" /> + </vbox> +</framewindow> diff --git a/toolkit/workben/layout/shutdown.xml b/toolkit/workben/layout/shutdown.xml new file mode 100644 index 000000000000..fbe49e046cb4 --- /dev/null +++ b/toolkit/workben/layout/shutdown.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="dialog" title="Shutdown Dialog" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> + <vbox border="5" spacing="5"> + <fixedline text="Platform default"/> + <dialogbuttonhbox border="5" spacing="5"> + <flow/> + <okbutton label="~Shutdown"/> + <cancelbutton/> + <pushbutton label="Pause"/> + <pushbutton label="Sleep"/> + <pushbutton label="Restart"/> + </dialogbuttonhbox> + <fixedline text="GNOME"/> + <dialogbuttonhbox border="5" spacing="5" ordering="gnome"> + <flow/> + <okbutton label="~Shutdown"/> + <cancelbutton/> + <pushbutton label="Pause"/> + <pushbutton label="Sleep"/> + <pushbutton label="Restart"/> + </dialogbuttonhbox> + <fixedline text="KDE"/> + <dialogbuttonhbox border="5" spacing="5" ordering="kde"> + <flow/> + <okbutton label="~Shutdown"/> + <cancelbutton/> + <pushbutton label="Pause"/> + <pushbutton label="Sleep"/> + <pushbutton label="Restart"/> + </dialogbuttonhbox> + <fixedline text="MacOS"/> + <dialogbuttonhbox border="5" spacing="5" ordering="macos"> + <flow/> + <okbutton label="~Shutdown"/> + <cancelbutton/> + <pushbutton label="Pause"/> + <pushbutton label="Sleep"/> + <pushbutton label="Restart"/> + </dialogbuttonhbox> + <fixedline text="Windows"/> + <dialogbuttonhbox border="5" spacing="5" ordering="windowsg"> + <flow/> + <okbutton label="~Shutdown"/> + <cancelbutton/> + <pushbutton label="Pause"/> + <pushbutton label="Sleep"/> + <pushbutton label="Restart"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/simple-paragraph.cxx b/toolkit/workben/layout/simple-paragraph.cxx new file mode 100644 index 000000000000..5acf09f5653a --- /dev/null +++ b/toolkit/workben/layout/simple-paragraph.cxx @@ -0,0 +1,159 @@ +#ifdef SVX_DLLIMPLEMENTATION +#undef SVX_DLLIMPLEMENTATION +#endif + +#include <toolkit/awt/vclxwindow.hxx> + +// include --------------------------------------------------------------- + +#include <stdio.h> + +#ifndef _SHL_HXX +#include <tools/shl.hxx> +#endif +#ifndef _SFX_OBJSH_HXX +#include <sfx2/objsh.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen wg. RET_OK, RET_CANCEL +#include <vcl/msgbox.hxx> +#endif + +#include <stdio.h> + +namespace SVX { +#include <svx/paraprev.hxx> // Preview +}; + +#include "simple-paragraph.hxx" + +#include <assert.h> + + + + + +// StandardTabPage ---------------------------------------------------------- + +#define FT_LEFTINDENT 10 +#define ED_LEFTINDENT 11 +#define FT_FLINEINDENT 12 +#define ED_FLINEINDENT 13 +#define FT_RIGHTINDENT 14 +#define ED_RIGHTINDENT 15 +#define FL_INDENT 16 + +#define FT_TOPDIST 20 +#define ED_TOPDIST 21 +#define FT_BOTTOMDIST 22 +#define ED_BOTTOMDIST 23 +#define FL_DIST 24 + +#define BTN_LEFTALIGN 30 +#define BTN_RIGHTALIGN 31 +#define BTN_CENTERALIGN 32 +#define BTN_JUSTIFYALIGN 33 +#define FL_ALIGN 34 +#define FL_VERTALIGN 35 +#define LB_VERTALIGN 36 +#define FL_VERTEX 37 +#define CB_SNAP 38 +#define FT_VERTALIGN 39 + + +#define LB_LINEDIST 40 +#define FT_LINEDIST 41 +#define ED_LINEDISTPERCENT 42 +#define ED_LINEDISTMETRIC 43 +#define FL_LINEDIST 44 +#define WN_EXAMPLE 46 + +#define CB_AUTO 48 +#define FT_LASTLINE 49 +#define LB_LASTLINE 50 +#define CB_EXPAND 51 +#define ST_LINEDIST_ABS 52 +#define ST_LEFTALIGN_ASIAN 53 +#define ST_RIGHTALIGN_ASIAN 54 + +// ExtendedTabPage ---------------------------------------------------------- + +#define BTN_HYPHEN 50 +#define ED_HYPHENBEFORE 52 +#define FT_HYPHENBEFORE 53 +#define ED_HYPHENAFTER 55 +#define FT_HYPHENAFTER 56 +#define FL_HYPHEN 57 + +#define BTN_PAGEBREAK 60 +#define FT_BREAKTYPE 61 +#define LB_BREAKTYPE 62 +#define FT_BREAKPOSITION 63 +#define LB_BREAKPOSITION 64 +#define BTN_PAGECOLL 65 +#define LB_PAGECOLL 66 +#define BTN_KEEPTOGETHER 67 +#define BTN_WIDOWS 68 +#define ED_WIDOWS 69 +#define FT_WIDOWS 70 +#define BTN_ORPHANS 71 +#define ED_ORPHANS 72 +#define FT_ORPHANS 73 +#define FL_OPTIONS 74 +#define FT_PAGENUM 75 +#define ED_PAGENUM 76 +#define FL_BREAKS 77 + +#define CB_KEEPTOGETHER 80 +#define FT_MAXHYPH 81 +#define ED_MAXHYPH 83 + +#define CB_REGISTER 84 +#define FL_REGISTER 85 +#define FL_PROPERTIES 90 +#define FT_TEXTDIRECTION 91 +#define LB_TEXTDIRECTION 92 + + +//asian typography +#define FL_AS_OPTIONS 1 +#define CB_AS_HANG_PUNC 2 +#define CB_AS_ALLOW_WORD_BREAK 3 +#define CB_AS_FORBIDDEN 4 +#define FL_AS_CHAR_DIST 5 +#define CB_AS_PUNCTUATION 6 +#define CB_AS_SCRIPT_SPACE 7 +#define CB_AS_ADJUST_NUMBERS 8 + + + + + + + + +SvxSimpleParagraphDialog::SvxSimpleParagraphDialog( Window* pParent ) : + SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ), + Dialog( pParent, "simple-paragraph.xml", "dialog" ), + aLineSpacingList( this, "line-spacing-list" ) +{ +fprintf(stderr, "creating res mgr\n"); + pMgr = ResMgr::CreateResMgr("SOME_NAME"); +fprintf(stderr, "getting parent\n"); + VCLXWindow *pCompParent = VCLXWindow::GetImplementation( GetPeer() ); + assert( pCompParent != NULL ); + assert( pCompParent->GetWindow() != NULL ); +fprintf(stderr, "creating foreign vcl widget\n"); +/* pPrevWin = new SVX::SvxParaPrevWindow( + pCompParent->GetWindow(), + ResId(1234, *pMgr) + );*/ + +fprintf(stderr, "done\n"); + FreeResource(); +} + +// ----------------------------------------------------------------------- + +SvxSimpleParagraphDialog::~SvxSimpleParagraphDialog() +{ +} diff --git a/toolkit/workben/layout/simple-paragraph.hxx b/toolkit/workben/layout/simple-paragraph.hxx new file mode 100644 index 000000000000..000bec5ba779 --- /dev/null +++ b/toolkit/workben/layout/simple-paragraph.hxx @@ -0,0 +1,25 @@ +#ifndef _SVX_SIMPLE_PARAGRAPH_HXX +#define _SVX_SIMPLE_PARAGRAPH_HXX + +#include <layout/layout.hxx> + +#include <svx/paraprev.hxx> // Preview + +namespace SVX { + class SvxParaPrevWindow; +}; +class ResMgr; + +class SvxSimpleParagraphDialog : public SfxTabPage, public layout::Dialog +{ +private: + ListBox aLineSpacingList; + SVX::SvxParaPrevWindow *pPrevWin; + ResMgr *pMgr; + +public: + SvxSimpleParagraphDialog( Window* pParent ); + ~SvxSimpleParagraphDialog(); +}; + +#endif diff --git a/toolkit/workben/layout/simple-paragraph.xml b/toolkit/workben/layout/simple-paragraph.xml new file mode 100644 index 000000000000..e07909dc8a39 --- /dev/null +++ b/toolkit/workben/layout/simple-paragraph.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="dialog" title="Paragraph test" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> + <vbox> + <listbox id="line-spacing-list" dropdown="true" cnt:expand="false" + string-item-list="Single:1.5 lines:Double:Proportional" /> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/splitter.xml b/toolkit/workben/layout/splitter.xml new file mode 100644 index 000000000000..634ad829b001 --- /dev/null +++ b/toolkit/workben/layout/splitter.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="Splitter Test" optimumsize="true" has_border="true" sizeable="true" moveable="true"> + <vbox> + <hsplitter> + <pushbutton label="Left" /> + <pushbutton label="Right" /> + </hsplitter> + <okbutton cnt:expand="false" /> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/tabcontrol.xml b/toolkit/workben/layout/tabcontrol.xml new file mode 100644 index 000000000000..99ad4f42fe34 --- /dev/null +++ b/toolkit/workben/layout/tabcontrol.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="TabControl Test" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> + <vbox> + <tabcontrol> +- <pushbutton label="Child 1" cnt:title="Page 1" /> + <edit has_border="true" text="Child 2" cnt:title="Page 2" /> + <vbox cnt:title="Page 3"> + <pushbutton label="Child 3"/> + <edit has_border="true" text="Child 4" /> + </vbox> + </tabcontrol> + <okbutton cnt:expand="false" /> + </vbox> +</dialog> diff --git a/toolkit/workben/layout/table.xml b/toolkit/workben/layout/table.xml new file mode 100644 index 000000000000..673bd85ddab3 --- /dev/null +++ b/toolkit/workben/layout/table.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="Table Test" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> + <table columns="3"> + <!-- row 0 --> + <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" /> + <pushbutton cnt:y-expand="false" label="1,2" /> + <pushbutton cnt:y-expand="false" label="1,3" /> + <!-- row 1 --> + <pushbutton cnt:col-span="2" label="2,1" /> + </table> +</dialog> diff --git a/toolkit/workben/layout/test.xml b/toolkit/workben/layout/test.xml new file mode 100644 index 000000000000..d0b4f9062912 --- /dev/null +++ b/toolkit/workben/layout/test.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<dialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + title="Interactable Containers" optimumsize="true" + has_border="true" sizeable="true" moveable="true"> + <tabcontrol> + <tabpage cnt:title="Page"> + <pushbutton label="Test" /> + </tabpage> + </tabcontrol> +</dialog> diff --git a/toolkit/workben/layout/un-test.sh b/toolkit/workben/layout/un-test.sh new file mode 100644 index 000000000000..ef2518ffa1b8 --- /dev/null +++ b/toolkit/workben/layout/un-test.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +# un-test.sh: remove TEST_LAYOUT code from OO.o implementation + +sed -e 's!^#!@!' < $1\ + -e 's!$! /*$*/!' \ + -e 's!^@\(.*TEST_LAYOUT\)!#\1!'\ + | tee i \ + | cpp -traditional -C -CC -DNON_LAYOUT_COMPILE_FIXES=1 \ + | grep -F '/*$*/' \ + | sed -e 's! /\*\$\*/!!' \ + -e 's!^@!#!' \ + -e 's!#define 1 1!#define NON_LAYOUT_COMPILE_FIXES 1!' + diff --git a/toolkit/workben/layout/wordcount-plain.xml b/toolkit/workben/layout/wordcount-plain.xml new file mode 100644 index 000000000000..cf31a7614840 --- /dev/null +++ b/toolkit/workben/layout/wordcount-plain.xml @@ -0,0 +1,29 @@ + + +<modaldialog sizeable="true" height="108" help-id="HID_DLG_WORDCOUNT" moveable="true" output-size="true" id="DLG_WORDCOUNT" sv-look="true" text="Word Count" width="170" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox> + <fixedline height="8" id="FL_CURRENT" text="Current selection" width="158" x="6" y="3"/> + <hbox> + <fixedtext height="8" id="FT_CURRENTWORD" label="Words:" width="80" x="12" y="14"/> + <fixedtext height="8" id="FI_CURRENTWORD" right="true" width="50" x="111" y="14"/> + </hbox> + <hbox> + <fixedtext height="8" id="FT_CURRENTCHARACTER" label="Characters:" width="80" x="12" y="26"/> + <fixedtext height="8" id="FI_CURRENTCHARACTER" right="true" width="50" x="111" y="26"/> + </hbox> + <fixedline height="8" id="FL_DOC" text="Whole document" width="158" x="6" y="40"/> + <hbox> + <fixedtext height="8" id="FT_DOCWORD" label="Words:" width="80" x="12" y="51"/> + <fixedtext height="8" id="FI_DOCWORD" right="true" width="50" x="111" y="51"/> + </hbox> + <hbox> + <fixedtext height="8" id="FT_DOCCHARACTER" label="Characters:" width="80" x="12" y="63"/> + <fixedtext height="8" id="FI_DOCCHARACTER" right="true" width="50" x="111" y="63"/> + </hbox> + <fixedline height="8" id="FL_BOTTOM" width="158" x="6" y="77"/> + <hbox> + <okbutton def-button="true" height="14" id="PB_OK" width="50" x="61" y="88"/> + <helpbutton height="14" id="PB_HELP" width="50" x="114" y="88"/> + </hbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/wordcount-tight.xml b/toolkit/workben/layout/wordcount-tight.xml new file mode 100644 index 000000000000..009113f6cdcf --- /dev/null +++ b/toolkit/workben/layout/wordcount-tight.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + help-id="HID_DLG_WORDCOUNT" + id="dialog" + sizeable="true" moveable="true" optimumsize="true" + has_border="true" sv-look="true" title="Word Count"> + <vbox border="5" spacing="5"> + <fixedline id="FL_CURRENT" text="Current selection"/> + <hbox> + <fixedtext id="FT_CURRENTWORD" label="Words:" cnt:padding="13"/> + <fixedinfo id="FI_CURRENTWORD" right="true" label="0" cnt:padding="13"/> + </hbox> + <hbox> + <fixedtext id="FT_CURRENTCHARACTER" label="Characters:" cnt:padding="13"/> + <fixedinfo id="FI_CURRENTCHARACTER" right="true" label="00" cnt:padding="13"/> + </hbox> + <fixedline id="FL_DOC" text="Whole document"/> + <hbox> + <fixedtext id="FT_DOCWORD" label="Words:" cnt:padding="13"/> + <fixedinfo id="FI_DOCWORD" right="true" label="000" cnt:padding="13"/> + </hbox> + <hbox> + <fixedtext id="FT_DOCCHARACTER" label="Characters:" cnt:padding="13"/> + <fixedinfo id="FI_DOCCHARACTER" right="true" label="0000" cnt:padding="13"/> + </hbox> + <fixedline cnt:padding="1" id="FL_BOTTOM"/> + <hbox border="5"> + <flow homogeneous="true"/> + <okbutton id="PB_OK" cnt:expand="false" default="true"/> + <helpbutton id="PB_HELP" cnt:expand="false"/> + </hbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/wordcount.xml b/toolkit/workben/layout/wordcount.xml new file mode 100644 index 000000000000..e71a042f51f6 --- /dev/null +++ b/toolkit/workben/layout/wordcount.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + help-id="HID_DLG_WORDCOUNT" + id="dialog" + sizeable="true" moveable="true" optimumsize="true" + has_border="true" sv-look="true" _title="Word Count"> + <vbox border="5" spacing="5"> + <fixedline id="FL_CURRENT" _text="Current selection"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <hbox> + <fixedtext id="FT_CURRENTWORD" _label="Words:"/> + <flow cnt:padding="60"/> + <fixedtext id="FI_CURRENTWORD" right="true" _label="0"/> + </hbox> + <hbox> + <fixedtext id="FT_CURRENTCHARACTER" _label="Characters:"/> + <flow cnt:padding="60"/> + <fixedtext id="FI_CURRENTCHARACTER" right="true" _label="00"/> + </hbox> + </vbox> + </hbox> + <!-- if we could do cnt:cnt:padding="-13" here, we would not have to close + and reope the hbox/vbox thing !--> + <fixedline id="FL_DOC" _text="Whole document"/> + <hbox> + <vbox cnt:padding="13" spacing="5"> + <hbox> + <fixedtext id="FT_DOCWORD" _label="Words:"/> + <fixedtext id="FI_DOCWORD" right="true" _label="000"/> + </hbox> + <hbox> + <fixedtext id="FT_DOCCHARACTER" _label="Characters:"/> + <fixedtext id="FI_DOCCHARACTER" right="true" _label="0000"/> + </hbox> + </vbox> + </hbox> + <fixedline cnt:padding="1" id="FL_BOTTOM"/> + <dialogbuttonhbox spacing="5"> + <flow/> + <okbutton id="PB_OK"/> + <helpbutton id="PB_HELP"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx new file mode 100644 index 000000000000..a0d40a8211c8 --- /dev/null +++ b/toolkit/workben/layout/wordcountdialog.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: wordcountdialog.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2008-03-06 12:07:32 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#if !TEST_LAYOUT +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#ifndef _SWTYPES_HXX +#include <swtypes.hxx> +#endif +#endif /* !TEST_LAYOUT */ +#ifndef SW_WORDCOUNTDIALOG_HXX +#include <wordcountdialog.hxx> +#endif +#if !TEST_LAYOUT +#ifndef _DOCSTAT_HXX +#include <docstat.hxx> +#endif + +#include <dialog.hrc> +#endif /* !TEST_LAYOUT */ +#include <layout/layout-pre.hxx> +#if !TEST_LAYOUT +#include <wordcountdialog.hrc> +#endif /* !TEST_LAYOUT */ + +/*-- 06.04.2004 16:05:55--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwWordCountDialog::SwWordCountDialog(Window* pParent) : + SfxModalDialog(pParent, SW_RES(DLG_WORDCOUNT)), +#if defined _MSC_VER +#pragma warning (disable : 4355) +#endif + aCurrentFL( this, SW_RES( FL_CURRENT )), + aCurrentWordFT( this, SW_RES( FT_CURRENTWORD )), + aCurrentWordFI( this, SW_RES( FI_CURRENTWORD )), + aCurrentCharacterFT( this, SW_RES( FT_CURRENTCHARACTER )), + aCurrentCharacterFI( this, SW_RES( FI_CURRENTCHARACTER )), + + aDocFL( this, SW_RES( FL_DOC )), + aDocWordFT( this, SW_RES( FT_DOCWORD )), + aDocWordFI( this, SW_RES( FI_DOCWORD )), + aDocCharacterFT( this, SW_RES( FT_DOCCHARACTER )), + aDocCharacterFI( this, SW_RES( FI_DOCCHARACTER )), + aBottomFL(this, SW_RES( FL_BOTTOM )), + aOK( this, SW_RES( PB_OK )), + aHelp( this, SW_RES( PB_HELP )) +#if defined _MSC_VER +#pragma warning (default : 4355) +#endif +{ + FreeResource(); +} +/*-- 06.04.2004 16:05:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwWordCountDialog::~SwWordCountDialog() +{ +} +/*-- 06.04.2004 16:05:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) +{ +#if !TEST_LAYOUT + aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord )); + aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar )); + aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord )); + aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar )); +#endif /* !TEST_LAYOUT */ +} + + + diff --git a/toolkit/workben/layout/wordcountdialog.hxx b/toolkit/workben/layout/wordcountdialog.hxx new file mode 100644 index 000000000000..65aed8e45f00 --- /dev/null +++ b/toolkit/workben/layout/wordcountdialog.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: wordcountdialog.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2008-03-06 12:07:43 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef SW_WORDCOUNTDIALOG_HXX +#define SW_WORDCOUNTDIALOG_HXX +#ifndef _BASEDLGS_HXX +#include <sfx2/basedlgs.hxx> +#endif +#ifndef _STDCTRL_HXX +#include <svtools/stdctrl.hxx> +#endif +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <layout/layout.hxx> +#include <layout/layout-pre.hxx> +struct SwDocStat; +class SwWordCountDialog : public SfxModalDialog +{ + FixedLine aCurrentFL; + FixedText aCurrentWordFT; + FixedInfo aCurrentWordFI; + FixedText aCurrentCharacterFT; + FixedInfo aCurrentCharacterFI; + + FixedLine aDocFL; + FixedText aDocWordFT; + FixedInfo aDocWordFI; + FixedText aDocCharacterFT; + FixedInfo aDocCharacterFI; + + FixedLine aBottomFL; + + OKButton aOK; + HelpButton aHelp; + +public: + SwWordCountDialog(Window* pParent); + ~SwWordCountDialog(); + + void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc); +}; + +#include <layout/layout-post.hxx> + +#endif diff --git a/toolkit/workben/layout/zoom-1.xml b/toolkit/workben/layout/zoom-1.xml new file mode 100644 index 000000000000..5fe06a3f270e --- /dev/null +++ b/toolkit/workben/layout/zoom-1.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="dialog" optimumsize="true" + help-id="SID_ATTR_ZOOM" + has_border="true" sizeable="true" moveable="true"> + <title id="tit" xml-lang="en-US">Set Zoom</title> + <vbox spacing="5" border="5"> + <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline> + <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton> + <hbox cnt:expand="false" cnt:fill="true"> + <align cnt:expand="false" cnt:fill="true"> + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton> + </align> + <flow cnt:padding="10" cnt:expand="false"/> + <metricfield id="ED_USER" value-step="1" + repeat="true" has_border="true" spin="true" + text="100%" unit="13" custom-unit-text="%" + right="true" + cnt:expand="false"/> + </hbox> + <fixedline cnt:padding="1" id="FL_BOTTOM"/> + <dialogbuttonhbox border="5" spacing="5"> + <flow/> + <okbutton id="BTN_ZOOM_OK"/> + <cancelbutton id="BTN_ZOOM_CANCEL"/> + <helpbutton id="BTN_ZOOM_HELP"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/zoom-2.xml b/toolkit/workben/layout/zoom-2.xml new file mode 100644 index 000000000000..c74e0c9a9da7 --- /dev/null +++ b/toolkit/workben/layout/zoom-2.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="dialog" optimumsize="true" + help-id="SID_ATTR_ZOOM" + has_border="true" sizeable="true" moveable="true" + xml-lang="en-US"> + Set Zoom + <vbox spacing="5" border="5"> + <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline> + <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton> + <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton> + <hbox cnt:expand="false" cnt:fill="true"> + <align cnt:expand="false" cnt:fill="true"> + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton> + </align> + <flow cnt:padding="10" cnt:expand="false"/> + <metricfield id="ED_USER" value-step="1" + repeat="true" has_border="true" spin="true" + text="100%" unit="13" custom-unit-text="%" + right="true" + cnt:expand="false"/> + </hbox> + <fixedline cnt:padding="1" id="FL_BOTTOM"/> + <dialogbuttonhbox border="5" spacing="5"> + <flow/> + <okbutton id="BTN_ZOOM_OK"/> + <cancelbutton id="BTN_ZOOM_CANCEL"/> + <helpbutton id="BTN_ZOOM_HELP"/> + </dialogbuttonhbox> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/zoom-indent.xml b/toolkit/workben/layout/zoom-indent.xml new file mode 100644 index 000000000000..7389780a3a9d --- /dev/null +++ b/toolkit/workben/layout/zoom-indent.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<modaldialog xmlns="http://openoffice.org/2007/layout" + xmlns:cnt="http://openoffice.org/2007/layout/container" + id="dialog" title="Set Zoom" optimumsize="true" + help-id="SID_ATTR_ZOOM" + has_border="true" sizeable="true" moveable="true"> + <hbox border="5" spacing="0"> + <vbox spacing="0"> + <fixedline id="FixedLine" text="Zoom factor" cnt:expand="true"/> + <hbox> <!-- for left margin !--> + <vbox cnt:padding="13" spacing="4" cnt:expand="true"> + <radiobutton radiogroup="zoom" id="WholePage" label="Whole Page"/> + <radiobutton radiogroup="zoom" id="PageWidth" label="Page Width"/> + <radiobutton radiogroup="zoom" id="Optimal" label="Optimal"/> + <radiobutton radiogroup="zoom" id="Zoom200" label="~200 %"/> + <radiobutton radiogroup="zoom" id="Zoom150" label="15~0 %"/> + <radiobutton radiogroup="zoom" id="Zoom100" label="~100 %"/> + <radiobutton radiogroup="zoom" id="Zoom75" label="~75 %"/> + <radiobutton radiogroup="zoom" id="Zoom50" label="~50 %"/> + <hbox cnt:expand="false"> + <align cnt:expand="false"> + <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BtnUser" label="~Variable"/> + </align> + <flow cnt:padding="10" cnt:expand="false"/> + <metricfield id="User" value-step="1" + repeat="true" has_border="true" spin="true" + text="100%" unit="11" custom-unit-text="%" + right="true"/> + <flow cnt:padding="10" cnt:expand="true"/> + </hbox> + </vbox> + </hbox> + </vbox> + <vbox border="6" spacing="4"> + <okbutton id="OkButton" cnt:expand="false" default="true"/> + <cancelbutton id="CancelButton" cnt:expand="false"/> + <helpbutton id="HelpButton" cnt:expand="false"/> + </vbox> + </hbox> +</modaldialog> diff --git a/toolkit/workben/layout/zoom-plain.xml b/toolkit/workben/layout/zoom-plain.xml new file mode 100644 index 000000000000..30b72a3e564f --- /dev/null +++ b/toolkit/workben/layout/zoom-plain.xml @@ -0,0 +1,20 @@ + + +<modaldialog sizeable="true" height="142" help-id="SID_ATTR_ZOOM" moveable="true" output-size="true" id="RID_SVXDLG_ZOOM" sv-look="true" text="Zoom" width="160" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"> + <vbox> + <fixedline height="8" id="FL_ZOOM" text="Zoom factor" width="92" x="6" y="3"/> + <okbutton def-button="true" height="14" id="BTN_ZOOM_OK" width="50" x="104" y="6"/> + <radiobutton height="10" id="BTN_WHOLE_PAGE" width="80" x="12" y="14"/> + <cancelbutton height="14" id="BTN_ZOOM_CANCEL" width="50" x="104" y="23"/> + <radiobutton height="10" id="BTN_PAGE_WIDTH" width="80" x="12" y="27"/> + <radiobutton height="10" id="BTN_OPTIMAL" width="80" x="12" y="40"/> + <helpbutton height="14" id="BTN_ZOOM_HELP" width="50" x="104" y="43"/> + <radiobutton height="10" id="BTN_200" label="~200 %" width="80" x="12" y="53"/> + <radiobutton height="10" id="BTN_150" label="15~0 %" width="80" x="12" y="66"/> + <radiobutton height="10" id="BTN_100" label="~100 %" width="80" x="12" y="79"/> + <radiobutton height="10" id="BTN_75" label="~75 %" width="80" x="12" y="92"/> + <radiobutton height="10" id="BTN_50" label="~50 %" width="80" x="12" y="105"/> + <metricfield has_border="true" custom-unit-text="%" group="true" height="12" left="true" repeat="true" id="ED_USER" spin="true" step-size="1" unit="FUNIT_CUSTOM" width="36" x="56" y="120"/> + <radiobutton height="10" id="BTN_USER" label="~Variable" width="42" x="12" y="121"/> + </vbox> +</modaldialog> diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx new file mode 100644 index 000000000000..eabbaae98148 --- /dev/null +++ b/toolkit/workben/layout/zoom.cxx @@ -0,0 +1,491 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zoom.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2008-03-06 12:09:02 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#if !TEST_LAYOUT +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" +#endif /* !TEST_LAYOUT */ + +#ifdef SVX_DLLIMPLEMENTATION +#undef SVX_DLLIMPLEMENTATION +#endif + +// include --------------------------------------------------------------- + +#if TEST_LAYOUT +#include <cstdio> +#endif /* TEST_LAYOUT */ +#ifndef _SHL_HXX +#include <tools/shl.hxx> +#endif +#ifndef _SFXITEMSET_HXX +#include <svtools/itemset.hxx> +#endif +#ifndef _SFXITEMPOOL_HXX +#include <svtools/itempool.hxx> +#endif +#ifndef _SFX_OBJSH_HXX +#include <sfx2/objsh.hxx> +#endif +#ifndef _SV_MSGBOX_HXX //autogen wg. RET_OK, RET_CANCEL +#include <vcl/msgbox.hxx> +#endif + +#define _SVX_ZOOM_CXX + +#include <svx/dialogs.hrc> +#if !ENABLE_LAYOUT +#include "zoom.hrc" +#endif /* !ENABLE_LAYOUT */ + +#include "zoom.hxx" +#if TEST_LAYOUT +#define SVX_ZOOM_OPTIMAL "Zoom optimal" +#define SVX_ZOOM_PAGEWIDTH "Zoom page width" +#define SVX_ZOOM_WHOLEPAGE "Zoom whole page" +struct SvxZoomItem +{ + void SetType( char const* s ) + { + fputs( s, stderr ); + } + + void SetValue( int n ) + { + fprintf( stderr, "Zoom factor: %d\n", int( n ) ); + } +}; +#else /* !TEST_LAYOUT */ +#include <svx/zoomitem.hxx> +#include <svx/dialmgr.hxx> +#endif /* !TEST_LAYOUT */ + +#ifndef _SVX_ZOOM_DEF_HXX +#include "zoom_def.hxx" +#endif + +#include <layout/layout-pre.hxx> + +// static ---------------------------------------------------------------- + +static USHORT pRanges[] = +{ + SID_ATTR_ZOOM, + SID_ATTR_ZOOM, + 0 +}; + +#define SPECIAL_FACTOR ((USHORT)0xFFFF) + +// class SvxZoomDialog --------------------------------------------------- + +USHORT SvxZoomDialog::GetFactor() const +{ + if ( a200Btn.IsChecked() ) + return 200; + if ( a150Btn.IsChecked() ) + return 150; + if ( a100Btn.IsChecked() ) + return 100; + if ( a75Btn.IsChecked() ) + return 75; + if ( a50Btn.IsChecked() ) + return 50; + if ( aUserBtn.IsChecked() ) + return (USHORT)aUserEdit.GetValue(); + else + return SPECIAL_FACTOR; +} + +// ----------------------------------------------------------------------- + +void SvxZoomDialog::SetFactor( USHORT nNewFactor, USHORT nBtnId ) +{ +#if TEST_LAYOUT + printf ("\t\t set factor %d\n", (int)nNewFactor); +#endif /* !TEST_LAYOUT */ + aUserEdit.Disable(); + + if ( !nBtnId ) + { + if ( nNewFactor == 200 ) + { + a200Btn.Check(); + a200Btn.GrabFocus(); + } + else if ( nNewFactor == 150 ) + { + a150Btn.Check(); + a150Btn.GrabFocus(); + } + else if ( nNewFactor == 100 ) + { + a100Btn.Check(); + a100Btn.GrabFocus(); + } + else if ( nNewFactor == 75 ) + { + a75Btn.Check(); + a75Btn.GrabFocus(); + } + else if ( nNewFactor == 50 ) + { + a50Btn.Check(); + a50Btn.GrabFocus(); + } + else + { + aUserBtn.Check(); + aUserEdit.Enable(); + aUserEdit.SetValue( (long)nNewFactor ); + aUserEdit.GrabFocus(); + } + } + else + { + aUserEdit.SetValue( (long)nNewFactor ); + + if ( ZOOMBTN_OPTIMAL == nBtnId ) + { + aOptimalBtn.Check(); + aOptimalBtn.GrabFocus(); + } + else if ( ZOOMBTN_PAGEWIDTH == nBtnId ) + { + aPageWidthBtn.Check(); + aPageWidthBtn.GrabFocus(); + } + else if ( ZOOMBTN_WHOLEPAGE == nBtnId ) + { + aWholePageBtn.Check(); + aWholePageBtn.GrabFocus(); + } + } +} + +// ----------------------------------------------------------------------- + +void SvxZoomDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt ) +{ + switch ( nBtnId ) + { + case ZOOMBTN_OPTIMAL: // Optimal-Button + aOptimalBtn.SetText( rNewTxt ); + break; + + case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button + aPageWidthBtn.SetText( rNewTxt ); + break; + + case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button + aWholePageBtn.SetText( rNewTxt ); + break; + + default: + DBG_ERROR( "wrong button number" ); + } +} + +// ----------------------------------------------------------------------- + +void SvxZoomDialog::HideButton( USHORT nBtnId ) +{ + switch ( nBtnId ) + { + case ZOOMBTN_OPTIMAL: // Optimal-Button + aOptimalBtn.Hide(); + break; + + case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button + aPageWidthBtn.Hide(); + break; + + case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button + aWholePageBtn.Hide(); + break; + + default: + DBG_ERROR( "Falsche Button-Nummer!!!" ); + } +} + +// ----------------------------------------------------------------------- + +void SvxZoomDialog::SetLimits( USHORT nMin, USHORT nMax ) +{ + DBG_ASSERT( nMin < nMax, "invalid limits" ); + aUserEdit.SetMin( nMin ); + aUserEdit.SetFirst( nMin ); + aUserEdit.SetMax( nMax ); + aUserEdit.SetLast( nMax ); +} + +// ----------------------------------------------------------------------- + +void SvxZoomDialog::SetSpinSize( USHORT nNewSpin ) +{ + aUserEdit.SetSpinSize( nNewSpin ); +} + +// ----------------------------------------------------------------------- + +#if TEST_LAYOUT +SvxZoomDialog::SvxZoomDialog( Window* pParent ) : +#else /* !TEST_LAYOUT */ +SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) : +#endif /* !TEST_LAYOUT */ + + SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_ZOOM ) ), + + aZoomFl ( this, SVX_RES( FL_ZOOM ) ), + aWholePageBtn ( this, SVX_RES( BTN_WHOLE_PAGE ) ), + aPageWidthBtn ( this, SVX_RES( BTN_PAGE_WIDTH ) ), + aOptimalBtn ( this, SVX_RES( BTN_OPTIMAL ) ), + a200Btn ( this, SVX_RES( BTN_200 ) ), + a150Btn ( this, SVX_RES( BTN_150 ) ), + a100Btn ( this, SVX_RES( BTN_100 ) ), + a75Btn ( this, SVX_RES( BTN_75 ) ), + a50Btn ( this, SVX_RES( BTN_50 ) ), + aUserBtn ( this, SVX_RES( BTN_USER ) ), + aUserEdit ( this, SVX_RES( ED_USER ) ), + aOKBtn ( this, SVX_RES( BTN_ZOOM_OK ) ), + aCancelBtn ( this, SVX_RES( BTN_ZOOM_CANCEL ) ), + aHelpBtn ( this, SVX_RES( BTN_ZOOM_HELP ) ), + +#if !TEST_LAYOUT + rSet ( rCoreSet ), +#endif /* !TEST_LAYOUT */ + pOutSet ( NULL ), + bModified ( FALSE ) + +{ + Link aLink = LINK( this, SvxZoomDialog, UserHdl ); + a200Btn.SetClickHdl( aLink ); + a150Btn.SetClickHdl( aLink ); + a100Btn.SetClickHdl( aLink ); + a75Btn.SetClickHdl( aLink ); + a50Btn.SetClickHdl( aLink ); + aOptimalBtn.SetClickHdl( aLink ); + aPageWidthBtn.SetClickHdl( aLink ); + aWholePageBtn.SetClickHdl( aLink ); + aUserBtn.SetClickHdl( aLink ); + aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) ); + aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) ); + + // Default-Werte + USHORT nValue = 100; + USHORT nMin = 10; + USHORT nMax = 1000; + +#if !TEST_LAYOUT + // ggf. erst den alten Wert besorgen + const SfxUInt16Item* pOldUserItem = 0; + SfxObjectShell* pSh = SfxObjectShell::Current(); + + if ( pSh ) + pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER ); + + if ( pOldUserItem ) + nValue = pOldUserItem->GetValue(); + + // UserEdit initialisieren + if ( nMin > nValue ) + nMin = nValue; + if ( nMax < nValue ) + nMax = nValue; +#endif /* !TEST_LAYOUT */ + aUserEdit.SetMin( nMin ); + aUserEdit.SetFirst( nMin ); + aUserEdit.SetMax( nMax ); + aUserEdit.SetLast( nMax ); + aUserEdit.SetValue( nValue ); + +#if TEST_LAYOUT + USHORT nZoom = 100; + SetFactor( nZoom ); +#else /* !TEST_LAYOUT */ + const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); + + if ( rItem.ISA(SvxZoomItem) ) + { + const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem; + USHORT nZoom = rZoomItem.GetValue(); + SvxZoomType eType = rZoomItem.GetType(); + USHORT nValSet = rZoomItem.GetValueSet(); + USHORT nBtnId = 0; + + switch ( eType ) + { + case SVX_ZOOM_OPTIMAL: + nBtnId = ZOOMBTN_OPTIMAL; + break; + case SVX_ZOOM_PAGEWIDTH: + nBtnId = ZOOMBTN_PAGEWIDTH; + break; + case SVX_ZOOM_WHOLEPAGE: + nBtnId = ZOOMBTN_WHOLEPAGE; + break; + case SVX_ZOOM_PERCENT: + break; + case SVX_ZOOM_PAGEWIDTH_NOBORDER: + break; + } + + // ggf. Buttons disablen + if ( !(SVX_ZOOM_ENABLE_50 & nValSet) ) + a50Btn.Disable(); + if ( !(SVX_ZOOM_ENABLE_75 & nValSet) ) + a75Btn.Disable(); + if ( !(SVX_ZOOM_ENABLE_100 & nValSet) ) + a100Btn.Disable(); + if ( !(SVX_ZOOM_ENABLE_150 & nValSet) ) + a150Btn.Disable(); + if ( !(SVX_ZOOM_ENABLE_200 & nValSet) ) + a200Btn.Disable(); + if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) ) + aOptimalBtn.Disable(); + if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) ) + aPageWidthBtn.Disable(); + if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) ) + aWholePageBtn.Disable(); + SetFactor( nZoom, nBtnId ); + } + else + { + USHORT nZoom = ( (const SfxUInt16Item&)rItem ).GetValue(); + SetFactor( nZoom ); + } +#endif /* !TEST_LAYOUT */ + + FreeResource(); +} + +// ----------------------------------------------------------------------- + +SvxZoomDialog::~SvxZoomDialog() +{ + delete pOutSet; + pOutSet = 0; +} + +// ----------------------------------------------------------------------- + +USHORT* SvxZoomDialog::GetRanges() +{ + return pRanges; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn ) +{ +#if TEST_LAYOUT + fprintf( stderr, "SvxZoomDialog::UserHdl\n" ); +#endif /* TEST_LAYOUT */ + bModified |= TRUE; + + if ( pBtn == &aUserBtn ) + { + aUserEdit.Enable(); + aUserEdit.GrabFocus(); + } + else + aUserEdit.Disable(); + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxZoomDialog, SpinHdl, MetricField *, EMPTYARG ) +{ + if ( !aUserBtn.IsChecked() ) + return 0; + bModified |= TRUE; + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn ) +{ + if ( bModified || &aOKBtn != pBtn ) + { +#if TEST_LAYOUT + SvxZoomItem aItem; +#else /* !TEST_LAYOUT */ + SvxZoomItem aItem( SVX_ZOOM_PERCENT, 0, + rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) ); + +#endif /* !TEST_LAYOUT */ + if ( &aOKBtn == pBtn ) + { + USHORT nFactor = GetFactor(); + + if ( SPECIAL_FACTOR == nFactor ) + { + if ( aOptimalBtn.IsChecked() ) + aItem.SetType( SVX_ZOOM_OPTIMAL ); + else if ( aPageWidthBtn.IsChecked() ) + aItem.SetType( SVX_ZOOM_PAGEWIDTH ); + else if ( aWholePageBtn.IsChecked() ) + aItem.SetType( SVX_ZOOM_WHOLEPAGE ); + } + else + aItem.SetValue( nFactor ); + } + else + { + DBG_ERROR( "Wrong Button" ); + return 0; + } +#if !TEST_LAYOUT + pOutSet = new SfxItemSet( rSet ); + pOutSet->Put( aItem ); + + // Wert aus dem UserEdit "uber den Dialog hinaus merken + SfxObjectShell* pSh = SfxObjectShell::Current(); + + if ( pSh ) + pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER, + (UINT16)aUserEdit.GetValue() ) ); +#endif /* !TEST_LAYOUT */ + EndDialog( RET_OK ); + } + else + EndDialog( RET_CANCEL ); + return 0; +} + + diff --git a/toolkit/workben/layout/zoom.hxx b/toolkit/workben/layout/zoom.hxx new file mode 100644 index 000000000000..d740679baae1 --- /dev/null +++ b/toolkit/workben/layout/zoom.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: zoom.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2008-03-06 12:09:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _SVX_ZOOM_HXX +#define _SVX_ZOOM_HXX + +// include --------------------------------------------------------------- + +#include <layout/layout.hxx> +#ifndef _BASEDLGS_HXX //autogen wg. SfxModalDialog +#include <sfx2/basedlgs.hxx> +#endif +#ifndef _SV_BUTTON_HXX //autogen wg. Radio-/OK-/Cancel-/HelpButton +#include <vcl/button.hxx> +#endif +#ifndef _SV_FIELD_HXX //autogen wg. MetricField +#include <vcl/field.hxx> +#endif +#ifndef _SV_FIXED_HXX +#include <vcl/fixed.hxx> +#endif + +// define ---------------------------------------------------------------- +/* CHINA001 +#define ZOOMBTN_OPTIMAL ((USHORT)0x0001) +#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002) +#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004) +*/ +#ifndef _SVX_ZOOM_HXX +#include "zoom_def.hxx" +#endif +// class SvxZoomDialog --------------------------------------------------- +/* + {k:\svx\prototyp\dialog\zoom.bmp} + + [Beschreibung] + Mit diesem Dialog wird ein Zoom-Faktor eingestellt. + + [Items] + SvxZoomItem <SID_ATTR_ZOOM> +*/ + +#include <layout/layout-pre.hxx> + +class SvxZoomDialog : public SfxModalDialog +{ +private: + FixedLine aZoomFl; + RadioButton aWholePageBtn; + RadioButton aPageWidthBtn; + RadioButton aOptimalBtn; + RadioButton a200Btn; + RadioButton a150Btn; + RadioButton a100Btn; + RadioButton a75Btn; + RadioButton a50Btn; + RadioButton aUserBtn; + MetricField aUserEdit; + OKButton aOKBtn; + CancelButton aCancelBtn; + HelpButton aHelpBtn; + +#if !TEST_LAYOUT + const SfxItemSet& rSet; +#endif /* !TEST_LAYOUT */ + SfxItemSet* pOutSet; + BOOL bModified; + +#ifdef _SVX_ZOOM_CXX + DECL_LINK( UserHdl, RadioButton* ); + DECL_LINK( SpinHdl, MetricField* ); + DECL_LINK( OKHdl, Button* ); +#endif + +public: +#if TEST_LAYOUT + SvxZoomDialog( Window* pParent ); +#else /* !TEST_LAYOUT */ + SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ); +#endif /* !TEST_LAYOUT */ + ~SvxZoomDialog(); + + static USHORT* GetRanges(); + const SfxItemSet* GetOutputItemSet() const { return pOutSet; } + + USHORT GetFactor() const; + void SetFactor( USHORT nNewFactor, USHORT nBtnId = 0 ); + + void SetButtonText( USHORT nBtnId, const String& aNewTxt ); + void HideButton( USHORT nBtnId ); + void SetLimits( USHORT nMin, USHORT nMax ); + void SetSpinSize( USHORT nNewSpin ); +}; + +#include <layout/layout-post.hxx> + +#endif + |