summaryrefslogtreecommitdiff
path: root/svx/source/dialog
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/dialog')
-rw-r--r--svx/source/dialog/SpellDialogChildWindow.cxx119
-rw-r--r--svx/source/dialog/_bmpmask.cxx1241
-rw-r--r--svx/source/dialog/_contdlg.cxx1161
-rw-r--r--svx/source/dialog/bmpmask.hrc62
-rw-r--r--svx/source/dialog/bmpmask.src373
-rw-r--r--svx/source/dialog/charmap.cxx893
-rw-r--r--svx/source/dialog/checklbx.cxx277
-rw-r--r--svx/source/dialog/connctrl.cxx387
-rw-r--r--svx/source/dialog/contdlg.hrc87
-rw-r--r--svx/source/dialog/contdlg.src290
-rw-r--r--svx/source/dialog/contimp.hxx127
-rw-r--r--svx/source/dialog/contwnd.cxx358
-rw-r--r--svx/source/dialog/contwnd.hxx90
-rw-r--r--svx/source/dialog/ctredlin.cxx1531
-rw-r--r--svx/source/dialog/ctredlin.hrc70
-rw-r--r--svx/source/dialog/ctredlin.src365
-rw-r--r--svx/source/dialog/databaseregistrationui.cxx69
-rw-r--r--svx/source/dialog/dialcontrol.cxx572
-rw-r--r--svx/source/dialog/dialmgr.cxx54
-rw-r--r--svx/source/dialog/dlgctl3d.cxx1323
-rw-r--r--svx/source/dialog/dlgctrl.cxx2287
-rw-r--r--svx/source/dialog/dlgctrl.src34
-rw-r--r--svx/source/dialog/dlgutil.cxx55
-rw-r--r--svx/source/dialog/docrecovery.cxx2181
-rw-r--r--svx/source/dialog/docrecovery.hrc292
-rw-r--r--svx/source/dialog/docrecovery.src654
-rw-r--r--svx/source/dialog/fntctrl.cxx851
-rw-r--r--svx/source/dialog/fontlb.cxx189
-rw-r--r--svx/source/dialog/fontwork.cxx1283
-rw-r--r--svx/source/dialog/fontwork.hrc67
-rw-r--r--svx/source/dialog/fontwork.src560
-rw-r--r--svx/source/dialog/framelink.cxx1531
-rw-r--r--svx/source/dialog/framelinkarray.cxx1247
-rw-r--r--svx/source/dialog/frmdirlbox.cxx127
-rw-r--r--svx/source/dialog/frmsel.cxx1205
-rw-r--r--svx/source/dialog/frmsel.src70
-rw-r--r--svx/source/dialog/graphctl.cxx960
-rw-r--r--svx/source/dialog/grfflt.cxx793
-rw-r--r--svx/source/dialog/hdft.cxx983
-rw-r--r--svx/source/dialog/hdft.hrc52
-rw-r--r--svx/source/dialog/hdft.src383
-rw-r--r--svx/source/dialog/hyperdlg.cxx107
-rw-r--r--svx/source/dialog/hyprdlg.hxx143
-rw-r--r--svx/source/dialog/hyprlink.cxx999
-rw-r--r--svx/source/dialog/hyprlink.hrc58
-rw-r--r--svx/source/dialog/hyprlink.src167
-rw-r--r--svx/source/dialog/imapdlg.cxx1055
-rw-r--r--svx/source/dialog/imapdlg.hrc106
-rw-r--r--svx/source/dialog/imapdlg.src369
-rw-r--r--svx/source/dialog/imapimp.hxx56
-rw-r--r--svx/source/dialog/imapwnd.cxx1069
-rw-r--r--svx/source/dialog/imapwnd.hxx226
-rw-r--r--svx/source/dialog/langbox.cxx526
-rw-r--r--svx/source/dialog/langbox.src49
-rw-r--r--svx/source/dialog/language.src66
-rw-r--r--svx/source/dialog/measctrl.cxx199
-rw-r--r--svx/source/dialog/optgrid.cxx415
-rw-r--r--svx/source/dialog/optgrid.hrc71
-rw-r--r--svx/source/dialog/optgrid.src372
-rw-r--r--svx/source/dialog/orienthelper.cxx206
-rw-r--r--svx/source/dialog/pagectrl.cxx421
-rw-r--r--svx/source/dialog/paraprev.cxx238
-rw-r--r--svx/source/dialog/passwd.cxx136
-rw-r--r--svx/source/dialog/passwd.hrc51
-rw-r--r--svx/source/dialog/passwd.src156
-rw-r--r--svx/source/dialog/pfiledlg.cxx280
-rw-r--r--svx/source/dialog/prtqry.cxx62
-rw-r--r--svx/source/dialog/prtqry.src74
-rw-r--r--svx/source/dialog/relfld.cxx146
-rw-r--r--svx/source/dialog/rlrcitem.cxx166
-rw-r--r--svx/source/dialog/rlrcitem.hxx51
-rw-r--r--svx/source/dialog/rubydialog.cxx990
-rw-r--r--svx/source/dialog/rubydialog.hrc53
-rw-r--r--svx/source/dialog/rubydialog.src221
-rw-r--r--svx/source/dialog/ruler.hrc37
-rw-r--r--svx/source/dialog/ruler.src137
-rw-r--r--svx/source/dialog/rulritem.cxx743
-rw-r--r--svx/source/dialog/sdstring.src1289
-rw-r--r--svx/source/dialog/sendreportgen.cxx53
-rw-r--r--svx/source/dialog/sendreportunx.cxx272
-rw-r--r--svx/source/dialog/sendreportw32.cxx260
-rw-r--r--svx/source/dialog/simptabl.cxx579
-rw-r--r--svx/source/dialog/srchctrl.cxx90
-rw-r--r--svx/source/dialog/srchctrl.hxx51
-rw-r--r--svx/source/dialog/srchdlg.cxx2549
-rw-r--r--svx/source/dialog/srchdlg.hrc93
-rw-r--r--svx/source/dialog/srchdlg.src442
-rw-r--r--svx/source/dialog/stddlg.cxx67
-rw-r--r--svx/source/dialog/strarray.cxx99
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.cxx572
-rw-r--r--svx/source/dialog/svxbmpnumvalueset.src127
-rw-r--r--svx/source/dialog/svxdlg.cxx41
-rw-r--r--svx/source/dialog/svxgrahicitem.cxx50
-rw-r--r--svx/source/dialog/svxruler.cxx3976
-rw-r--r--svx/source/dialog/swframeexample.cxx737
-rw-r--r--svx/source/dialog/swframeposstrings.cxx76
-rw-r--r--svx/source/dialog/swframeposstrings.src245
-rw-r--r--svx/source/dialog/txencbox.cxx254
-rw-r--r--svx/source/dialog/txenctab.cxx76
-rw-r--r--svx/source/dialog/txenctab.src122
-rwxr-xr-xsvx/source/dialog/ucsubset.src511
-rw-r--r--svx/source/dialog/wrapfield.cxx61
102 files changed, 48166 insertions, 0 deletions
diff --git a/svx/source/dialog/SpellDialogChildWindow.cxx b/svx/source/dialog/SpellDialogChildWindow.cxx
new file mode 100644
index 000000000000..22dcdcc3a1be
--- /dev/null
+++ b/svx/source/dialog/SpellDialogChildWindow.cxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/SpellDialogChildWindow.hxx>
+
+#include <svx/svxdlg.hxx>
+
+namespace svx {
+
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellDialogChildWindow::SpellDialogChildWindow (
+ Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* /*pInfo*/)
+ : SfxChildWindow (_pParent, nId)
+
+{
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SvxAbstractDialogFactory::Create() failed");
+ m_pAbstractSpellDialog = pFact->CreateSvxSpellDialog(_pParent,
+ pBindings,
+ this );
+ pWindow = m_pAbstractSpellDialog->GetWindow();
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ SetHideNotDelete (sal_True);
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SpellDialogChildWindow::~SpellDialogChildWindow (void)
+{
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxBindings& SpellDialogChildWindow::GetBindings (void) const
+{
+ OSL_ASSERT (m_pAbstractSpellDialog != NULL);
+ return m_pAbstractSpellDialog->GetBindings();
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::InvalidateSpellDialog()
+{
+ OSL_ASSERT (m_pAbstractSpellDialog != NULL);
+ if(m_pAbstractSpellDialog)
+ m_pAbstractSpellDialog->Invalidate();
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::HasAutoCorrection()
+{
+ return false;
+}
+/*-------------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::AddAutoCorrection(
+ const String& /*rOld*/,
+ const String& /*rNew*/,
+ LanguageType /*eLanguage*/)
+{
+ DBG_ERROR("AutoCorrection should have been overloaded - if available");
+}
+/*-- 16.06.2008 10:11:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::HasGrammarChecking()
+{
+ return false;
+}
+/*-- 18.06.2008 12:26:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SpellDialogChildWindow::IsGrammarChecking()
+{
+ DBG_ERROR("Grammar checking should have been overloaded - if available");
+ return false;
+}
+/*-- 18.06.2008 12:26:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SpellDialogChildWindow::SetGrammarChecking(bool )
+{
+ DBG_ERROR("Grammar checking should have been overloaded - if available");
+}
+} // end of namespace ::svx
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
new file mode 100644
index 000000000000..9c2a5fc9a3bb
--- /dev/null
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -0,0 +1,1241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <vcl/wrkwin.hxx>
+#include <tools/shl.hxx>
+#include <vcl/metaact.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svtools/colrdlg.hxx>
+
+#define BMPMASK_PRIVATE
+
+#include <svx/dialmgr.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/dialogs.hrc>
+#include <bmpmask.hrc>
+#include <svx/svxids.hrc>
+
+//-------------------------------------------------------------------------
+
+#define BMP_RESID(nId) ResId(nId, DIALOG_MGR())
+#define TRANSP_STRING "Transparent"
+#define TRANSP_COL (Color( 252, 252, 252 ))
+#define OWN_CALLMODE SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD
+
+//-------------------------------------------------------------------------
+
+#define TEST_COLS() \
+{ \
+ nR = aCol.GetRed(); nG = aCol.GetGreen(); nB = aCol.GetBlue(); \
+ for( i = 0; i < nCount; i++ ) \
+ { \
+ if ( ( pMinR[i] <= nR ) && ( pMaxR[i] >= nR ) && \
+ ( pMinG[i] <= nG ) && ( pMaxG[i] >= nG ) && \
+ ( pMinB[i] <= nB ) && ( pMaxB[i] >= nB ) ) \
+ { \
+ aCol = pDstCols[i]; bReplace = sal_True; break; \
+ } \
+ } \
+}
+
+// -------------------------------------------------------------------------
+
+SFX_IMPL_DOCKINGWINDOW( SvxBmpMaskChildWindow, SID_BMPMASK )
+
+// -------------------------------------------------------------------------
+
+class ColorWindow : public Control
+{
+ Color aColor;
+
+
+public:
+
+ ColorWindow( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ aColor( COL_WHITE ) {};
+
+ ColorWindow( Window* pParent, const ResId& rId ) :
+ Control( pParent, rId ),
+ aColor( COL_WHITE ) {};
+
+ void SetColor( const Color& rColor )
+ {
+ aColor = rColor;
+ Invalidate();
+ }
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+//-------------------------------------------------------------------------
+
+class MaskSet : public ValueSet
+{
+ SvxBmpMask* pSvxBmpMask;
+
+
+public:
+ MaskSet( SvxBmpMask* pParent, WinBits nWinStyle );
+ MaskSet( SvxBmpMask* pParent, const ResId& rId );
+
+ virtual void Select();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+
+ void onEditColor();
+};
+
+//-------------------------------------------------------------------------
+
+MaskSet::MaskSet( SvxBmpMask* pParent, WinBits nWinStyle ) :
+ ValueSet ( pParent, nWinStyle ),
+ pSvxBmpMask ( pParent )
+{
+}
+
+//-------------------------------------------------------------------------
+
+MaskSet::MaskSet( SvxBmpMask* pParent, const ResId& rId ) :
+ ValueSet ( pParent, rId ),
+ pSvxBmpMask ( pParent )
+{
+}
+
+//-------------------------------------------------------------------------
+
+void MaskSet::Select()
+{
+ ValueSet::Select();
+
+ pSvxBmpMask->onSelect( this );
+}
+
+void MaskSet::GetFocus()
+{
+ SelectItem( 1 );
+ pSvxBmpMask->onSelect( this );
+}
+
+void MaskSet::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ // if the key has a modifier we don't care
+ if( aCode.GetModifier() )
+ {
+ ValueSet::KeyInput( rKEvt );
+ }
+ else
+ {
+ // check for keys that interests us
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ onEditColor();
+ break;
+ default:
+ ValueSet::KeyInput( rKEvt );
+ }
+
+ }
+}
+
+void MaskSet::onEditColor()
+{
+ SvColorDialog* pColorDlg = new SvColorDialog( GetParent() );
+
+ pColorDlg->SetColor(GetItemColor(1));
+
+ if( pColorDlg->Execute() )
+ SetItemColor( 1, pColorDlg->GetColor() );
+
+ delete pColorDlg;
+}
+
+//-------------------------------------------------------------------------
+
+class MaskData
+{
+ SvxBmpMask* pMask;
+ sal_Bool bIsReady;
+ sal_Bool bExecState;
+ SfxBindings& rBindings;
+
+public:
+ MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind );
+
+ sal_Bool IsCbxReady() const { return bIsReady; }
+ void SetExecState( sal_Bool bState ) { bExecState = bState; }
+ sal_Bool IsExecReady() const { return bExecState; }
+
+ DECL_LINK( PipetteHdl, ToolBox* pTbx );
+ DECL_LINK( CbxHdl, CheckBox* pCbx );
+ DECL_LINK( CbxTransHdl, CheckBox* pCbx );
+ DECL_LINK( FocusLbHdl, ColorLB* pLb );
+ DECL_LINK( ExecHdl, PushButton* pBtn );
+};
+
+//-------------------------------------------------------------------------
+
+MaskData::MaskData( SvxBmpMask* pBmpMask, SfxBindings& rBind ) :
+
+ pMask ( pBmpMask ),
+ bIsReady ( sal_False ),
+ bExecState ( sal_False ),
+ rBindings ( rBind )
+
+{
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, PipetteHdl, ToolBox*, pTbx )
+{
+ SfxBoolItem aBItem( SID_BMPMASK_PIPETTE,
+ pTbx->IsItemChecked( TBI_PIPETTE ) );
+
+ rBindings.GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aBItem, 0L );
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, CbxHdl, CheckBox*, pCbx )
+{
+ bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() ||
+ pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked();
+
+ if ( bIsReady && IsExecReady() )
+ pMask->aBtnExec.Enable();
+ else
+ pMask->aBtnExec.Disable();
+
+ // Wenn eine Checkbox gecheckt wurde, wird die Pipette enabled
+ if ( pCbx->IsChecked() )
+ {
+ MaskSet* pSet = NULL;
+
+ if ( pCbx == &( pMask->aCbx1 ) )
+ pSet = pMask->pQSet1;
+ else if ( pCbx == &( pMask->aCbx2 ) )
+ pSet = pMask->pQSet2;
+ else if ( pCbx == &( pMask->aCbx3 ) )
+ pSet = pMask->pQSet3;
+ else // if ( pCbx == &( pMask->aCbx4 ) )
+ pSet = pMask->pQSet4;
+
+ pSet->SelectItem( 1 );
+ pSet->Select();
+
+ pMask->aTbxPipette.CheckItem( TBI_PIPETTE, sal_True );
+ PipetteHdl( &( pMask->aTbxPipette ) );
+ }
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, CbxTransHdl, CheckBox*, pCbx )
+{
+ bIsReady = pCbx->IsChecked();
+ if ( bIsReady )
+ {
+ pMask->pQSet1->Disable();
+ pMask->pQSet2->Disable();
+ pMask->pQSet3->Disable();
+ pMask->pQSet4->Disable();
+ pMask->pCtlPipette->Disable();
+ pMask->aCbx1.Disable();
+ pMask->aSp1.Disable();
+ pMask->aCbx2.Disable();
+ pMask->aSp2.Disable();
+ pMask->aCbx3.Disable();
+ pMask->aSp3.Disable();
+ pMask->aCbx4.Disable();
+ pMask->aSp4.Disable();
+ pMask->aTbxPipette.Disable();
+
+ pMask->aLbColor1.Disable();
+ pMask->aLbColor2.Disable();
+ pMask->aLbColor3.Disable();
+ pMask->aLbColor4.Disable();
+ pMask->aLbColorTrans.Enable();
+ }
+ else
+ {
+ pMask->pQSet1->Enable();
+ pMask->pQSet2->Enable();
+ pMask->pQSet3->Enable();
+ pMask->pQSet4->Enable();
+ pMask->pCtlPipette->Enable();
+ pMask->aCbx1.Enable();
+ pMask->aSp1.Enable();
+ pMask->aCbx2.Enable();
+ pMask->aSp2.Enable();
+ pMask->aCbx3.Enable();
+ pMask->aSp3.Enable();
+ pMask->aCbx4.Enable();
+ pMask->aSp4.Enable();
+ pMask->aTbxPipette.Enable();
+
+ pMask->aLbColor1.Enable();
+ pMask->aLbColor2.Enable();
+ pMask->aLbColor3.Enable();
+ pMask->aLbColor4.Enable();
+ pMask->aLbColorTrans.Disable();
+
+ bIsReady = pMask->aCbx1.IsChecked() || pMask->aCbx2.IsChecked() ||
+ pMask->aCbx3.IsChecked() || pMask->aCbx4.IsChecked();
+ }
+
+ if ( bIsReady && IsExecReady() )
+ pMask->aBtnExec.Enable();
+ else
+ pMask->aBtnExec.Disable();
+
+ return 0L;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb )
+{
+ pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 );
+ pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 );
+ pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 );
+ pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 );
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+IMPL_LINK( MaskData, ExecHdl, PushButton*, EMPTYARG )
+{
+ SfxBoolItem aBItem( SID_BMPMASK_EXEC, sal_True );
+ rBindings.GetDispatcher()->Execute( SID_BMPMASK_EXEC, OWN_CALLMODE, &aBItem, 0L );
+
+ return 0L;
+}
+
+//-------------------------------------------------------------------------
+
+void ColorWindow::Paint( const Rectangle &/*Rect*/ )
+{
+ const Color& rOldLineColor = GetLineColor();
+ const Color& rOldFillColor = GetFillColor();
+
+ SetLineColor( aColor );
+ SetFillColor( aColor );
+
+ DrawRect( Rectangle( Point(), GetSizePixel() ) );
+
+ SetLineColor( rOldLineColor );
+ SetFillColor( rOldFillColor );
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMaskSelectItem::SvxBmpMaskSelectItem( sal_uInt16 nId_, SvxBmpMask& rMask,
+ SfxBindings& rBindings ) :
+ SfxControllerItem ( nId_, rBindings ),
+ rBmpMask ( rMask)
+{
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMaskSelectItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ if ( ( nSID == SID_BMPMASK_EXEC ) && pItem )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ rBmpMask.SetExecState( pStateItem->GetValue() );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMaskChildWindow::SvxBmpMaskChildWindow( Window* pParent_, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( pParent_, nId )
+{
+ pWindow = new SvxBmpMask( pBindings, this, pParent_,
+ BMP_RESID( RID_SVXDLG_BMPMASK ) );
+ SvxBmpMask* pDlg = (SvxBmpMask*) pWindow;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* pParent,
+ const ResId& rResId ) :
+ SfxDockingWindow ( pBindinx, pCW, pParent, rResId ),
+ aTbxPipette ( this, BMP_RESID( TBX_PIPETTE ) ),
+ pCtlPipette ( new ColorWindow( this, BMP_RESID( WND_PIPETTE ) ) ),
+ aBtnExec ( this, BMP_RESID( BTN_EXEC ) ),
+ aGrpQ ( this, BMP_RESID( GRP_Q ) ),
+
+ aCbx1 ( this, BMP_RESID( CBX_1 ) ),
+ pQSet1 ( new MaskSet( this, BMP_RESID( QCOL_1 ) ) ),
+ aSp1 ( this, BMP_RESID( SP_1 ) ),
+ aLbColor1 ( this, BMP_RESID ( LB_1 ) ),
+
+ aCbx2 ( this, BMP_RESID( CBX_2 ) ),
+ pQSet2 ( new MaskSet( this, BMP_RESID( QCOL_2 ) ) ),
+ aSp2 ( this, BMP_RESID( SP_2 ) ),
+ aLbColor2 ( this, BMP_RESID ( LB_2 ) ),
+
+ aCbx3 ( this, BMP_RESID( CBX_3 ) ),
+ pQSet3 ( new MaskSet( this, BMP_RESID( QCOL_3 ) ) ),
+ aSp3 ( this, BMP_RESID( SP_3 ) ),
+ aLbColor3 ( this, BMP_RESID ( LB_3 ) ),
+
+ aCbx4 ( this, BMP_RESID( CBX_4 ) ),
+ pQSet4 ( new MaskSet( this, BMP_RESID( QCOL_4 ) ) ),
+ aSp4 ( this, BMP_RESID( SP_4 ) ),
+ aLbColor4 ( this, BMP_RESID ( LB_4 ) ),
+
+ pData ( new MaskData( this, *pBindinx ) ),
+ aCbxTrans ( this, BMP_RESID( CBX_TRANS ) ),
+ aLbColorTrans ( this, BMP_RESID ( LB_TRANS ) ),
+ aFt1 ( this, BMP_RESID ( FT_1 ) ),
+ aFt2 ( this, BMP_RESID ( FT_2 ) ),
+ aFt3 ( this, BMP_RESID ( FT_3 ) ),
+ pColTab ( NULL ),
+ aPipetteColor ( COL_WHITE ),
+ aSelItem ( SID_BMPMASK_EXEC, *this, *pBindinx ),
+ maImgPipette ( BMP_RESID ( IMG_PIPETTE ) ),
+ maImgPipetteH ( BMP_RESID ( IMG_PIPETTE_H ) )
+{
+ FreeResource();
+
+ ApplyStyle();
+
+ aTbxPipette.SetSizePixel( aTbxPipette.CalcWindowSizePixel() );
+ aTbxPipette.SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) );
+ aBtnExec.SetClickHdl( LINK( pData, MaskData, ExecHdl ) );
+
+ aCbx1.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx2.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx3.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbx4.SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
+ aCbxTrans.SetClickHdl( LINK( pData, MaskData, CbxTransHdl ) );
+
+ SetAccessibleNames ();
+
+ aLbColor1.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor2.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor3.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColor4.SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+ aLbColorTrans.Disable();
+
+ aSp1.SetValue( 10 );
+ aSp2.SetValue( 10 );
+ aSp3.SetValue( 10 );
+ aSp4.SetValue( 10 );
+
+ pQSet1->SetStyle( pQSet1->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet1->SetColCount( 1 );
+ pQSet1->SetLineCount( 1 );
+// pQSet1->SetExtraSpacing( 1 );
+ pQSet1->InsertItem( 1, aPipetteColor );
+ pQSet1->SelectItem( 1 );
+
+ pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet2->SetColCount( 1 );
+ pQSet2->SetLineCount( 1 );
+// pQSet2->SetExtraSpacing( 1 );
+ pQSet2->InsertItem( 1, aPipetteColor );
+ pQSet2->SelectItem( 0 );
+
+ pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet3->SetColCount( 1 );
+ pQSet3->SetLineCount( 1 );
+// pQSet3->SetExtraSpacing( 1 );
+ pQSet3->InsertItem( 1, aPipetteColor );
+ pQSet3->SelectItem( 0 );
+
+ pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
+ pQSet4->SetColCount( 1 );
+ pQSet4->SetLineCount( 1 );
+// pQSet4->SetExtraSpacing( 1 );
+ pQSet4->InsertItem( 1, aPipetteColor );
+ pQSet4->SelectItem( 0 );
+
+ pQSet1->Show();
+ pQSet2->Show();
+ pQSet3->Show();
+ pQSet4->Show();
+}
+
+//-------------------------------------------------------------------------
+
+SvxBmpMask::~SvxBmpMask()
+{
+ delete pQSet1;
+ delete pQSet2;
+ delete pQSet3;
+ delete pQSet4;
+ delete pCtlPipette;
+ delete pData;
+}
+
+//-------------------------------------------------------------------------
+
+/** is called by a MaskSet when it is selected */
+void SvxBmpMask::onSelect( MaskSet* pSet )
+{
+ // automaticaly set focus to the corresponding listbox
+/*
+ if( pSet == pQSet1 )
+ aLbColor1.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor2.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor3.GrabFocus();
+ else if( pSet == pQSet2 )
+ aLbColor4.GrabFocus();
+*/
+
+ // now deselect all other value sets
+ if( pSet != pQSet1 )
+ pQSet1->SelectItem( 0 );
+
+ if( pSet != pQSet2 )
+ pQSet2->SelectItem( 0 );
+
+ if( pSet != pQSet3 )
+ pQSet3->SelectItem( 0 );
+
+ if( pSet != pQSet4 )
+ pQSet4->SelectItem( 0 );
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::Close()
+{
+ SfxBoolItem aItem2( SID_BMPMASK_PIPETTE, sal_False );
+ GetBindings().GetDispatcher()->Execute( SID_BMPMASK_PIPETTE, OWN_CALLMODE, &aItem2, 0L );
+
+ return SfxDockingWindow::Close();
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::NeedsColorTable() const
+{
+ return ( aLbColor1.GetEntryCount() == 0 );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetColorTable( const XColorTable* pTable )
+{
+ if ( pTable && ( pTable != pColTab ) )
+ {
+ const String aTransp( BMP_RESID( RID_SVXDLG_BMPMASK_STR_TRANSP ) );
+
+ pColTab = pTable;
+
+ aLbColorTrans.Fill( pColTab );
+ aLbColorTrans.SelectEntryPos( 0 );
+
+ aLbColor1.Fill( pColTab );
+ aLbColor1.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor1.SelectEntryPos( 0 );
+
+ aLbColor2.Fill( pColTab );
+ aLbColor2.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor2.SelectEntryPos( 0 );
+
+ aLbColor3.Fill( pColTab );
+ aLbColor3.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor3.SelectEntryPos( 0 );
+
+ aLbColor4.Fill( pColTab );
+ aLbColor4.InsertEntry( TRANSP_COL, aTransp, 0 );
+ aLbColor4.SelectEntryPos( 0 );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetColor( const Color& rColor )
+{
+ aPipetteColor = rColor;
+ pCtlPipette->SetColor( aPipetteColor );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::PipetteClicked()
+{
+ if( pQSet1->GetSelectItemId() == 1 )
+ {
+ aCbx1.Check( sal_True );
+ pData->CbxHdl( &aCbx1 );
+ pQSet1->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet2->GetSelectItemId() == 1 )
+ {
+ aCbx2.Check( sal_True );
+ pData->CbxHdl( &aCbx2 );
+ pQSet2->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet3->GetSelectItemId() == 1 )
+ {
+ aCbx3.Check( sal_True );
+ pData->CbxHdl( &aCbx3 );
+ pQSet3->SetItemColor( 1, aPipetteColor );
+ }
+ else if( pQSet4->GetSelectItemId() == 1 )
+ {
+ aCbx4.Check( sal_True );
+ pData->CbxHdl( &aCbx4 );
+ pQSet4->SetItemColor( 1, aPipetteColor );
+ }
+
+ aTbxPipette.CheckItem( TBI_PIPETTE, sal_False );
+ pData->PipetteHdl( &aTbxPipette );
+}
+
+//-------------------------------------------------------------------------
+
+void SvxBmpMask::SetExecState( sal_Bool bEnable )
+{
+ pData->SetExecState( bEnable );
+
+ if ( pData->IsExecReady() && pData->IsCbxReady() )
+ aBtnExec.Enable();
+ else
+ aBtnExec.Disable();
+}
+
+//-------------------------------------------------------------------------
+
+sal_uInt16 SvxBmpMask::InitColorArrays( Color* pSrcCols, Color* pDstCols, sal_uIntPtr* pTols )
+{
+ sal_uInt16 nCount = 0;
+
+ if ( aCbx1.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet1->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor1.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp1.GetValue());
+ }
+
+ if ( aCbx2.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet2->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor2.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp2.GetValue());
+ }
+
+ if ( aCbx3.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet3->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor3.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp3.GetValue());
+ }
+
+ if ( aCbx4.IsChecked() )
+ {
+ pSrcCols[nCount] = pQSet4->GetItemColor( 1 );
+ pDstCols[nCount] = aLbColor4.GetSelectEntryColor();
+ pTols[nCount++] = static_cast<sal_uIntPtr>(aSp4.GetValue());
+ }
+
+ return nCount;
+}
+
+//-------------------------------------------------------------------------
+
+Bitmap SvxBmpMask::ImpMask( const Bitmap& rBitmap )
+{
+ Bitmap aBitmap( rBitmap );
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ const sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+
+ EnterWait();
+ aBitmap.Replace( pSrcCols, pDstCols, nCount, pTols );
+ LeaveWait();
+
+ return aBitmap;
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpMask( const BitmapEx& rBitmapEx )
+{
+ return BitmapEx( ImpMask( rBitmapEx.GetBitmap() ), rBitmapEx.GetMask() );
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpMaskTransparent( const BitmapEx& rBitmapEx, const Color& rColor, const long nTol )
+{
+ EnterWait();
+
+ BitmapEx aBmpEx;
+ Bitmap aMask( rBitmapEx.GetBitmap().CreateMask( rColor, nTol ) );
+
+ if( rBitmapEx.IsTransparent() )
+ aMask.CombineSimple( rBitmapEx.GetMask(), BMP_COMBINE_OR );
+
+ aBmpEx = BitmapEx( rBitmapEx.GetBitmap(), aMask );
+ LeaveWait();
+
+ return aBmpEx;
+}
+
+//-------------------------------------------------------------------------
+
+Animation SvxBmpMask::ImpMask( const Animation& rAnimation )
+{
+ Animation aAnimation( rAnimation );
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ InitColorArrays( pSrcCols, pDstCols, pTols );
+ sal_uInt16 nAnimationCount = aAnimation.Count();
+
+ for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
+ {
+ AnimationBitmap aAnimBmp( aAnimation.Get( i ) );
+ aAnimBmp.aBmpEx = Mask( aAnimBmp.aBmpEx ).GetBitmapEx();
+ aAnimation.Replace( aAnimBmp, i );
+ }
+
+ return aAnimation;
+}
+
+//-------------------------------------------------------------------------
+
+GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
+{
+ GDIMetaFile aMtf;
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+ sal_Bool pTrans[4];
+
+ // Falls keine Farben ausgewaehlt, kopieren wir nur das Mtf
+ if( !nCount )
+ aMtf = rMtf;
+ else
+ {
+ Color aCol;
+ long nVal;
+ long nTol;
+ long nR;
+ long nG;
+ long nB;
+ long* pMinR = new long[nCount];
+ long* pMaxR = new long[nCount];
+ long* pMinG = new long[nCount];
+ long* pMaxG = new long[nCount];
+ long* pMinB = new long[nCount];
+ long* pMaxB = new long[nCount];
+ sal_uInt16 i;
+ sal_Bool bReplace;
+
+ aMtf.SetPrefSize( rMtf.GetPrefSize() );
+ aMtf.SetPrefMapMode( rMtf.GetPrefMapMode() );
+
+ // Farbvergleichsarrays vorbereiten
+ for( i = 0; i < nCount; i++ )
+ {
+ nTol = ( pTols[i] * 255L ) / 100L;
+
+ nVal = ( (long) pSrcCols[i].GetRed() );
+ pMinR[i] = Max( nVal - nTol, 0L );
+ pMaxR[i] = Min( nVal + nTol, 255L );
+
+ nVal = ( (long) pSrcCols[i].GetGreen() );
+ pMinG[i] = Max( nVal - nTol, 0L );
+ pMaxG[i] = Min( nVal + nTol, 255L );
+
+ nVal = ( (long) pSrcCols[i].GetBlue() );
+ pMinB[i] = Max( nVal - nTol, 0L );
+ pMaxB[i] = Min( nVal + nTol, 255L );
+
+ pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL );
+ }
+
+ // Actions untersuchen und Farben ggf. ersetzen
+ for( sal_uIntPtr nAct = 0UL, nActCount = rMtf.GetActionCount(); nAct < nActCount; nAct++ )
+ {
+ MetaAction* pAction = rMtf.GetAction( nAct );
+
+ bReplace = sal_False;
+
+ switch( pAction->GetType() )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ MetaPixelAction* pAct = (MetaPixelAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaPixelAction( pAct->GetPoint(), aCol );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaLineColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaFillColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ MetaTextColorAction* pAct = (MetaTextColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaTextColorAction( aCol );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ MetaTextFillColorAction* pAct = (MetaTextFillColorAction*) pAction;
+
+ aCol = pAct->GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ pAct = new MetaTextFillColorAction( aCol, !pTrans[ i ] );
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ MetaFontAction* pAct = (MetaFontAction*) pAction;
+ Font aFont( pAct->GetFont() );
+
+ aCol = aFont.GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ {
+ aFont.SetColor( aCol );
+ pAct = new MetaFontAction( aFont );
+ }
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction;
+ Wallpaper aWall( pAct->GetWallpaper() );
+
+ aCol = aWall.GetColor();
+ TEST_COLS();
+
+ if( bReplace )
+ {
+ aWall.SetColor( aCol );
+ pAct = new MetaWallpaperAction( pAct->GetRect(), aWall );
+ }
+ else
+ pAct->Duplicate();
+
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ MetaBmpAction* pAct = (MetaBmpAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpAction( pAct->GetPoint(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
+ const Bitmap aBmp( Mask( pAct->GetBitmap() ).GetBitmap() );
+
+ pAct = new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmp );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ MetaBmpExAction* pAct = (MetaBmpExAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExAction( pAct->GetPoint(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
+ const BitmapEx aBmpEx( Mask( pAct->GetBitmapEx() ).GetBitmapEx() );
+
+ pAct = new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(), aBmpEx );
+ aMtf.AddAction( pAct );
+ }
+ break;
+
+ default:
+ {
+ pAction->Duplicate();
+ aMtf.AddAction( pAction );
+ }
+ break;
+ }
+ }
+
+ delete[] pMinR;
+ delete[] pMaxR;
+ delete[] pMinG;
+ delete[] pMaxG;
+ delete[] pMinB;
+ delete[] pMaxB;
+ }
+
+ LeaveWait();
+
+ return aMtf;
+}
+
+//-------------------------------------------------------------------------
+
+BitmapEx SvxBmpMask::ImpReplaceTransparency( const BitmapEx& rBmpEx, const Color& rColor )
+{
+ if( rBmpEx.IsTransparent() )
+ {
+ Bitmap aBmp( rBmpEx.GetBitmap() );
+ aBmp.Replace( rBmpEx.GetMask(), rColor );
+ return aBmp;
+ }
+ else
+ return rBmpEx;
+}
+
+//-------------------------------------------------------------------------
+
+Animation SvxBmpMask::ImpReplaceTransparency( const Animation& rAnim, const Color& rColor )
+{
+ Animation aAnimation( rAnim );
+ sal_uInt16 nAnimationCount = aAnimation.Count();
+
+ for( sal_uInt16 i = 0; i < nAnimationCount; i++ )
+ {
+ AnimationBitmap aAnimBmp( aAnimation.Get( i ) );
+ aAnimBmp.aBmpEx = ImpReplaceTransparency( aAnimBmp.aBmpEx, rColor );
+ aAnimation.Replace( aAnimBmp, i );
+ }
+
+ return aAnimation;
+}
+
+//-------------------------------------------------------------------------
+
+GDIMetaFile SvxBmpMask::ImpReplaceTransparency( const GDIMetaFile& rMtf, const Color& rColor )
+{
+ VirtualDevice aVDev;
+ GDIMetaFile aMtf;
+ const MapMode& rPrefMap = rMtf.GetPrefMapMode();
+ const Size& rPrefSize = rMtf.GetPrefSize();
+ const sal_uIntPtr nActionCount = rMtf.GetActionCount();
+
+ aVDev.EnableOutput( sal_False );
+ aMtf.Record( &aVDev );
+ aMtf.SetPrefSize( rPrefSize );
+ aMtf.SetPrefMapMode( rPrefMap );
+ aVDev.SetLineColor( rColor );
+ aVDev.SetFillColor( rColor );
+
+ // Actions nacheinander abspielen; zuerst
+ // den gesamten Bereich auf die Ersatzfarbe setzen
+ aVDev.DrawRect( Rectangle( rPrefMap.GetOrigin(), rPrefSize ) );
+ for ( sal_uIntPtr i = 0; i < nActionCount; i++ )
+ {
+ MetaAction* pAct = rMtf.GetAction( i );
+
+ pAct->Duplicate();
+ aMtf.AddAction( pAct );
+ }
+
+ aMtf.Stop();
+ aMtf.WindStart();
+
+ return aMtf;
+}
+
+//-------------------------------------------------------------------------
+
+Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
+{
+ Graphic aGraphic( rGraphic );
+ const Color aReplColor( aLbColorTrans.GetSelectEntryColor() );
+
+ switch( rGraphic.GetType() )
+ {
+ case( GRAPHIC_BITMAP ):
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ // Transparenz ersetzen?
+ if ( aCbxTrans.IsChecked() )
+ aGraphic = ImpReplaceTransparency( rGraphic.GetAnimation(), aReplColor );
+ else
+ aGraphic = ImpMask( rGraphic.GetAnimation() );
+ }
+ else
+ {
+ // Transparenz ersetzen?
+ if( aCbxTrans.IsChecked() )
+ {
+ if( aGraphic.IsTransparent() )
+ {
+ BitmapEx aBmpEx( ImpReplaceTransparency( aGraphic.GetBitmapEx(), aReplColor ) );
+ const Size aSize( aBmpEx.GetSizePixel() );
+
+ if( aSize.Width() && aSize.Height() )
+ aGraphic = aBmpEx;
+ }
+ }
+ else
+ {
+ Color pSrcCols[4];
+ Color pDstCols[4];
+ sal_uIntPtr pTols[4];
+ sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
+
+ if( nCount )
+ {
+ // erstmal alle Transparent-Farben setzen
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ // Haben wir eine Transparenzfarbe?
+ if( pDstCols[i] == TRANSP_COL )
+ {
+ BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(),
+ pSrcCols[ i ], pTols[ i ] ) );
+ const Size aSize( aBmpEx.GetSizePixel() );
+
+ if( aSize.Width() && aSize.Height() )
+ aGraphic = aBmpEx;
+ }
+ }
+
+ // jetzt noch einmal mit den normalen Farben ersetzen
+ Bitmap aBitmap( ImpMask( aGraphic.GetBitmap() ) );
+ Size aSize( aBitmap.GetSizePixel() );
+
+ if ( aSize.Width() && aSize.Height() )
+ {
+ if ( aGraphic.IsTransparent() )
+ aGraphic = Graphic( BitmapEx( aBitmap, aGraphic.GetBitmapEx().GetMask() ) );
+ else
+ aGraphic = aBitmap;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case( GRAPHIC_GDIMETAFILE ):
+ {
+ GDIMetaFile aMtf( aGraphic.GetGDIMetaFile() );
+
+ // Transparenz ersetzen?
+ if( aCbxTrans.IsChecked() )
+ aMtf = ImpReplaceTransparency( aMtf, aReplColor );
+ else
+ aMtf = ImpMask( aMtf );
+
+ Size aSize( aMtf.GetPrefSize() );
+ if ( aSize.Width() && aSize.Height() )
+ aGraphic = Graphic( aMtf );
+ else
+ aGraphic = rGraphic;
+ }
+ break;
+
+ default:
+ aGraphic = rGraphic;
+ break;
+ }
+
+ if( aGraphic != rGraphic )
+ {
+ aGraphic.SetPrefSize( rGraphic.GetPrefSize() );
+ aGraphic.SetPrefMapMode( rGraphic.GetPrefMapMode() );
+ }
+
+ return aGraphic;
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool SvxBmpMask::IsEyedropping() const
+{
+ return aTbxPipette.IsItemChecked( TBI_PIPETTE );
+}
+
+void SvxBmpMask::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxDockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyStyle();
+}
+
+void SvxBmpMask::ApplyStyle()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ aTbxPipette.SetItemImage( TBI_PIPETTE, bHighContrast ? maImgPipetteH : maImgPipette );
+}
+
+
+/** Set an accessible name for the source color check boxes. Without this
+ the lengthy description is read.
+*/
+void SvxBmpMask::SetAccessibleNames (void)
+{
+ String sSourceColor (BMP_RESID( RID_SVXDLG_BMPMASK_STR_SOURCECOLOR));
+ String sSourceColorN;
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+ aCbx1.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+ aCbx2.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+ aCbx3.SetAccessibleName (sSourceColorN);
+
+ sSourceColorN = sSourceColor;
+ sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+ aCbx4.SetAccessibleName (sSourceColorN);
+}
diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx
new file mode 100644
index 000000000000..cff80865e1c8
--- /dev/null
+++ b/svx/source/dialog/_contdlg.cxx
@@ -0,0 +1,1161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sot/factory.hxx>
+#include <tools/shl.hxx>
+#include <vcl/salbtype.hxx> // FRound
+#include <vcl/msgbox.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svtools/miscopt.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+#define _SDR_NOITEMS
+#define _SDR_NOTOUCH
+#define _SDR_NOTRANSFORM
+#define _SDR_NOOBJECTS
+#define _SDR_NOVIEWMARKER
+#define _SDR_NODRAGMETHODS
+#define _SDR_NOUNDO
+#define _SDR_NOXOUTDEV
+#define _XOUTBMP_STATICS_ONLY
+
+#include <svx/dialmgr.hxx>
+#include "svx/xoutbmp.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <svx/contdlg.hxx>
+#include "contimp.hxx"
+#include "contdlg.hrc"
+#include "contwnd.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdopath.hxx>
+#include "svx/dlgutil.hxx"
+#include <vcl/svapp.hxx>
+
+/******************************************************************************/
+
+inline String GetUnitString( long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep )
+{
+ String aVal = UniString::CreateFromInt64( MetricField::ConvertValue( nVal_100, 2, MAP_100TH_MM, eFieldUnit ) );
+
+ while( aVal.Len() < 3 )
+ aVal.Insert( sal_Unicode('0'), 0 );
+
+ aVal.Insert( cSep, aVal.Len() - 2 );
+ aVal += sal_Unicode(' ');
+ aVal += SdrFormatter::GetUnitStr( eFieldUnit );
+
+ return aVal;
+}
+
+
+/******************************************************************************/
+
+
+SFX_IMPL_FLOATINGWINDOW( SvxContourDlgChildWindow, SID_CONTOUR_DLG );
+
+
+/******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* ControllerItem
+|*
+\************************************************************************/
+
+SvxContourDlgItem::SvxContourDlgItem( sal_uInt16 _nId, SvxSuperContourDlg& rContourDlg, SfxBindings& rBindings ) :
+ SfxControllerItem ( _nId, rBindings ),
+ rDlg ( rContourDlg )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pItem )
+{
+ if ( pItem && ( SID_CONTOUR_EXEC == nSID ) )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ rDlg.SetExecState( !pStateItem->GetValue() );
+ }
+}
+
+
+/******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Contour-Float
+|*
+\************************************************************************/
+
+SvxContourDlgChildWindow::SvxContourDlgChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ SvxSuperContourDlg* pDlg = new SvxSuperContourDlg( pBindings, this, _pParent, CONT_RESID( RID_SVXDLG_CONTOUR ) );
+ pWindow = pDlg;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlgChildWindow::UpdateContourDlg( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ if ( SfxViewFrame::Current() &&
+ SfxViewFrame::Current()->HasChildWindow( SvxContourDlgChildWindow::GetChildWindowId() ) )
+ SVXCONTOURDLG()->Update( rGraphic, bGraphicLinked, pPolyPoly, pEditingObj );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxContourDlg::SvxContourDlg( SfxBindings* _pBindings, SfxChildWindow* pCW,
+ Window* _pParent, const ResId& rResId ) :
+
+ SfxFloatingWindow ( _pBindings, pCW, _pParent, rResId )
+
+{
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxContourDlg::~SvxContourDlg()
+{
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
+ const Rectangle* pRect,
+ const sal_uIntPtr nFlags )
+{
+ Bitmap aBmp;
+ sal_uIntPtr nContourFlags = XOUTBMP_CONTOUR_HORZ;
+
+ if ( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ VirtualDevice aVDev;
+ MapMode aTransMap;
+ PolyPolygon aAnimPolyPoly;
+ const Animation aAnim( rGraphic.GetAnimation() );
+ const Size& rSizePix = aAnim.GetDisplaySizePixel();
+ const sal_uInt16 nCount = aAnim.Count();
+
+ if ( aVDev.SetOutputSizePixel( rSizePix ) )
+ {
+ aVDev.SetLineColor( Color( COL_BLACK ) );
+ aVDev.SetFillColor( Color( COL_BLACK ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rStepBmp = aAnim.Get( i );
+
+ // Polygonausgabe an die richtige Stelle schieben;
+ // dies ist der Offset des Teilbildes innerhalb
+ // der Gesamtanimation
+ aTransMap.SetOrigin( Point( rStepBmp.aPosPix.X(), rStepBmp.aPosPix.Y() ) );
+ aVDev.SetMapMode( aTransMap );
+ aVDev.DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) );
+ }
+
+ aTransMap.SetOrigin( Point() );
+ aVDev.SetMapMode( aTransMap );
+ aBmp = aVDev.GetBitmap( Point(), rSizePix );
+ aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+ }
+ }
+ else if( rGraphic.IsTransparent() )
+ aBmp = rGraphic.GetBitmapEx().GetMask();
+ else
+ {
+ aBmp = rGraphic.GetBitmap();
+ nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
+ }
+ }
+ else if( rGraphic.GetType() != GRAPHIC_NONE )
+ {
+ const Graphic aTmpGrf( rGraphic.GetGDIMetaFile().GetMonochromeMtf( Color( COL_BLACK ) ) );
+ VirtualDevice aVDev;
+ Size aSizePix( aVDev.LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) );
+
+ if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) )
+ {
+ double fWH = (double) aSizePix.Width() / aSizePix.Height();
+
+ if( fWH <= 1.0 )
+ aSizePix.Width() = FRound( ( aSizePix.Height() = 512 ) * fWH );
+ else
+ aSizePix.Height() = FRound( ( aSizePix.Width() = 512 ) / fWH );
+ }
+
+ if( aVDev.SetOutputSizePixel( aSizePix ) )
+ {
+ const Point aPt;
+ aTmpGrf.Draw( &aVDev, aPt, aSizePix );
+ aBmp = aVDev.GetBitmap( aPt, aSizePix );
+ }
+
+ nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
+ }
+
+ aBmp.SetPrefSize( rGraphic.GetPrefSize() );
+ aBmp.SetPrefMapMode( rGraphic.GetPrefMapMode() );
+
+ return PolyPolygon( XOutBitmap::GetCountour( aBmp, nContourFlags, 128, pRect ) );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxContourDlg::ScaleContour( PolyPolygon& rContour, const Graphic& rGraphic,
+ const MapUnit eUnit, const Size& rDisplaySize )
+{
+ DBG_ASSERT( rGraphic.GetType() != GRAPHIC_NONE, "Graphic is not valid!" );
+
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ const MapMode aDispMap( eUnit );
+ const MapMode aGrfMap( rGraphic.GetPrefMapMode() );
+ const Size aGrfSize( rGraphic.GetPrefSize() );
+ double fScaleX;
+ double fScaleY;
+ Size aOrgSize;
+ Point aNewPoint;
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ if ( bPixelMap )
+ aOrgSize = pOutDev->PixelToLogic( aGrfSize, aDispMap );
+ else
+ aOrgSize = pOutDev->LogicToLogic( aGrfSize, aGrfMap, aDispMap );
+
+ if ( aOrgSize.Width() && aOrgSize.Height() )
+ {
+ fScaleX = (double) rDisplaySize.Width() / aOrgSize.Width();
+ fScaleY = (double) rDisplaySize.Height() / aOrgSize.Height();
+
+ for ( sal_uInt16 j = 0, nPolyCount = rContour.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = rContour[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ if ( bPixelMap )
+ aNewPoint = pOutDev->PixelToLogic( rPoly[ i ], aDispMap );
+ else
+ aNewPoint = pOutDev->LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
+
+ rPoly[ i ] = Point( FRound( aNewPoint.X() * fScaleX ), FRound( aNewPoint.Y() * fScaleY ) );
+ }
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Durchschleifen an SuperClass; keine virt. Methoden, um
+|* bei IF-Aenderungen nicht inkompatibel zu werden
+|*
+\************************************************************************/
+
+void SvxContourDlg::SetExecState( sal_Bool bEnable )
+{
+ pSuperClass->SetExecState( bEnable );
+}
+
+void SvxContourDlg::SetGraphic( const Graphic& rGraphic )
+{
+ pSuperClass->SetGraphic( rGraphic );
+}
+
+void SvxContourDlg::SetGraphicLinked( sal_Bool bGraphicLinked )
+{
+ pSuperClass->SetGraphicLinked( bGraphicLinked );
+}
+
+const Graphic& SvxContourDlg::GetGraphic() const
+{
+ return pSuperClass->GetGraphic();
+}
+
+sal_Bool SvxContourDlg::IsGraphicChanged() const
+{
+ return pSuperClass->IsGraphicChanged();
+}
+
+void SvxContourDlg::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ pSuperClass->SetPolyPolygon( rPolyPoly );
+}
+
+PolyPolygon SvxContourDlg::GetPolyPolygon()
+{
+ return pSuperClass->GetPolyPolygon( sal_True );
+}
+
+void SvxContourDlg::SetEditingObject( void* pObj )
+{
+ pSuperClass->SetEditingObject( pObj );
+}
+
+const void* SvxContourDlg::GetEditingObject() const
+{
+ return pSuperClass->GetEditingObject();
+}
+
+void SvxContourDlg::Update( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ pSuperClass->UpdateGraphic( rGraphic, bGraphicLinked, pPolyPoly, pEditingObj );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxSuperContourDlg::SvxSuperContourDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SvxContourDlg ( _pBindings, pCW, _pParent, rResId ),
+ pCheckObj ( NULL ),
+ aContourItem ( SID_CONTOUR_EXEC, *this, *_pBindings ),
+ aTbx1 ( this, ResId( TBX1, *rResId.GetResMgr() ) ),
+ aMtfTolerance ( this, ResId( MTF_TOLERANCE, *rResId.GetResMgr() ) ),
+ aContourWnd ( this, ResId( CTL_CONTOUR, *rResId.GetResMgr() ) ),
+ aStbStatus ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
+ nGrfChanged ( 0UL ),
+ bExecState ( sal_False ),
+ bGraphicLinked ( sal_False ),
+ maImageList ( SVX_RES( CD_IMAPDLG ) ),
+ maImageListH ( SVX_RES( CDH_IMAPDLG ) )
+{
+ ApplyImageList();
+
+ FreeResource();
+
+ SvxContourDlg::SetSuperClass( *this );
+
+ aContourWnd.SetMousePosLink( LINK( this, SvxSuperContourDlg, MousePosHdl ) );
+ aContourWnd.SetGraphSizeLink( LINK( this, SvxSuperContourDlg, GraphSizeHdl ) );
+ aContourWnd.SetUpdateLink( LINK( this, SvxSuperContourDlg, StateHdl ) );
+ aContourWnd.SetPipetteHdl( LINK( this, SvxSuperContourDlg, PipetteHdl ) );
+ aContourWnd.SetPipetteClickHdl( LINK( this, SvxSuperContourDlg, PipetteClickHdl ) );
+ aContourWnd.SetWorkplaceClickHdl( LINK( this, SvxSuperContourDlg, WorkplaceClickHdl ) );
+
+ const Size aTbxSize( aTbx1.CalcWindowSizePixel() );
+ Point aPos( aTbx1.GetPosPixel() );
+ SvtMiscOptions aMiscOptions;
+
+ aMiscOptions.AddListenerLink( LINK( this, SvxSuperContourDlg, MiscHdl ) );
+
+ aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ aTbx1.SetSizePixel( aTbxSize );
+ aTbx1.SetSelectHdl( LINK( this, SvxSuperContourDlg, Tbx1ClickHdl ) );
+
+ aPos.X() += aTbxSize.Width() + LogicToPixel( Size( 3, 0 ), MapMode( MAP_APPFONT ) ).Width();
+ aMtfTolerance.SetPosPixel( aPos );
+ aMtfTolerance.SetValue( 10L );
+
+ SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
+
+ aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
+ aStbStatus.InsertItem( 2, 10 + GetTextWidth( String::CreateFromAscii( " 9999,99 cm / 9999,99 cm " ) ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 3, 10 + GetTextWidth( String::CreateFromAscii( " 9999,99 cm x 9999,99 cm " ) ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 4, 20, SIB_CENTER | SIB_IN );
+
+ Resize();
+
+ aUpdateTimer.SetTimeout( 100 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, UpdateHdl ) );
+
+ aCreateTimer.SetTimeout( 50 );
+ aCreateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, CreateHdl ) );
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxSuperContourDlg::~SvxSuperContourDlg()
+{
+}
+
+
+/*************************************************************************
+|*
+|* Resize-Methode
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::Resize()
+{
+ SfxFloatingWindow::Resize();
+
+ Size aMinSize( GetMinOutputSizePixel() );
+ Size aNewSize( GetOutputSizePixel() );
+
+ if ( aNewSize.Height() >= aMinSize.Height() )
+ {
+ Size _aSize( aStbStatus.GetSizePixel() );
+ Point aPoint( 0, aNewSize.Height() - _aSize.Height() );
+
+ // StatusBar positionieren
+ aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
+ aStbStatus.Show();
+
+ // EditWindow positionieren
+ _aSize.Width() = aNewSize.Width() - 18;
+ _aSize.Height() = aPoint.Y() - aContourWnd.GetPosPixel().Y() - 6;
+ aContourWnd.SetSizePixel( _aSize );
+
+ aLastSize = aNewSize;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Close-Methode
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::Close()
+{
+ sal_Bool bRet = sal_True;
+
+ if ( aTbx1.IsItemEnabled( TBI_APPLY ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( CONT_RESID( STR_CONTOURDLG_MODIFY ) ) );
+ const long nRet = aQBox.Execute();
+
+ if ( nRet == RET_YES )
+ {
+ SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CONTOUR_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ else if ( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+
+ return( bRet ? SfxFloatingWindow::Close() : sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Enabled oder disabled alle Controls
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetExecState( sal_Bool bEnable )
+{
+ bExecState = bEnable;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetGraphic( const Graphic& rGraphic )
+{
+ aUndoGraphic = aRedoGraphic = Graphic();
+ aGraphic = rGraphic;
+ nGrfChanged = 0UL;
+ aContourWnd.SetGraphic( aGraphic );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ DBG_ASSERT( aContourWnd.GetGraphic().GetType() != GRAPHIC_NONE, "Graphic must've been set first!" );
+
+ PolyPolygon aPolyPoly( rPolyPoly );
+ const MapMode aMap100( MAP_100TH_MM );
+ const MapMode aGrfMap( aGraphic.GetPrefMapMode() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ for ( sal_uInt16 j = 0, nPolyCount = aPolyPoly.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = aPolyPoly[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ Point& rPt = rPoly[ i ];
+
+ if ( !bPixelMap )
+ rPt = pOutDev->LogicToPixel( rPt, aGrfMap );
+
+ rPt = pOutDev->PixelToLogic( rPt, aMap100 );
+ }
+ }
+
+ aContourWnd.SetPolyPolygon( aPolyPoly );
+ aContourWnd.GetSdrModel()->SetChanged( sal_True );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+PolyPolygon SvxSuperContourDlg::GetPolyPolygon( sal_Bool bRescaleToGraphic )
+{
+ PolyPolygon aRetPolyPoly( aContourWnd.GetPolyPolygon() );
+
+ if ( bRescaleToGraphic )
+ {
+ const MapMode aMap100( MAP_100TH_MM );
+ const MapMode aGrfMap( aGraphic.GetPrefMapMode() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
+
+ for ( sal_uInt16 j = 0, nPolyCount = aRetPolyPoly.Count(); j < nPolyCount; j++ )
+ {
+ Polygon& rPoly = aRetPolyPoly[ j ];
+
+ for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ Point& rPt = rPoly[ i ];
+
+ rPt = pOutDev->LogicToPixel( rPt, aMap100 );
+
+ if ( !bPixelMap )
+ rPt = pOutDev->PixelToLogic( rPt, aGrfMap );
+ }
+ }
+ }
+
+ return aRetPolyPoly;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::UpdateGraphic( const Graphic& rGraphic, sal_Bool _bGraphicLinked,
+ const PolyPolygon* pPolyPoly, void* pEditingObj )
+{
+ aUpdateGraphic = rGraphic;
+ bUpdateGraphicLinked = _bGraphicLinked;
+ pUpdateEditingObject = pEditingObj;
+
+ if ( pPolyPoly )
+ aUpdatePolyPoly = *pPolyPoly;
+ else
+ aUpdatePolyPoly = PolyPolygon();
+
+ aUpdateTimer.Start();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::IsUndoPossible() const
+{
+ return aUndoGraphic.GetType() != GRAPHIC_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxSuperContourDlg::IsRedoPossible() const
+{
+ return aRedoGraphic.GetType() != GRAPHIC_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::DoAutoCreate()
+{
+ aCreateTimer.Start();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxSuperContourDlg::ReducePoints( const long nTol )
+{
+ PolyPolygon aPolyPoly( GetPolyPolygon( sal_False ) );
+
+ if ( aPolyPoly.Count() )
+ {
+ const MapMode aMapMode( MAP_100TH_MM );
+ const long nTol2 = nTol * nTol;
+ Polygon& rPoly = aPolyPoly[ 0 ];
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+ Point aPtPix;
+ const sal_uInt16 nSize = rPoly.GetSize();
+ sal_uInt16 nCounter = 0;
+
+ if ( nSize )
+ aPtPix = pOutDev->LogicToPixel( rPoly[ 0 ], aMapMode );
+
+ for( sal_uInt16 i = 1; i < nSize; i++ )
+ {
+ const Point& rNewPt = rPoly[ i ];
+ const Point aNewPtPix( pOutDev->LogicToPixel( rNewPt, aMapMode ) );
+
+ const long nDistX = aNewPtPix.X() - aPtPix.X();
+ const long nDistY = aNewPtPix.Y() - aPtPix.Y();
+
+ if( ( nDistX * nDistX + nDistY * nDistY ) >= nTol2 )
+ {
+ rPoly[ ++nCounter ] = rNewPt;
+ aPtPix = aNewPtPix;
+ }
+ }
+
+ rPoly.SetSize( nCounter );
+ aContourWnd.SetPolyPolygon( aPolyPoly );
+ aContourWnd.GetSdrModel()->SetChanged( sal_True );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Click-Hdl fuer ToolBox
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
+{
+ sal_uInt16 nNewItemId = pTbx->GetCurItemId();
+
+ switch( pTbx->GetCurItemId() )
+ {
+ case( TBI_APPLY ):
+ {
+ SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CONTOUR_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ break;
+
+ case( TBI_WORKPLACE ):
+ {
+ if ( aTbx1.IsItemChecked( TBI_WORKPLACE ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_NO, String( CONT_RESID( STR_CONTOURDLG_WORKPLACE ) ) );
+
+ if ( !aContourWnd.IsContourChanged() || ( aQBox.Execute() == RET_YES ) )
+ aContourWnd.SetWorkplaceMode( sal_True );
+ else
+ aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
+ }
+ else
+ aContourWnd.SetWorkplaceMode( sal_False );
+ }
+ break;
+
+ case( TBI_SELECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetEditMode( sal_True );
+ }
+ break;
+
+ case( TBI_RECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_RECT );
+ }
+ break;
+
+ case( TBI_CIRCLE ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_CIRC );
+
+ }
+ break;
+
+ case( TBI_POLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_POLY );
+ }
+ break;
+
+ case( TBI_FREEPOLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ aContourWnd.SetObjKind( OBJ_FREEFILL );
+ }
+ break;
+
+ case( TBI_POLYEDIT ):
+ aContourWnd.SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
+ break;
+
+ case( TBI_POLYMOVE ):
+ aContourWnd.SetPolyEditMode( SID_BEZIER_MOVE );
+ break;
+
+ case( TBI_POLYINSERT ):
+ aContourWnd.SetPolyEditMode( SID_BEZIER_INSERT );
+ break;
+
+ case( TBI_POLYDELETE ):
+ aContourWnd.GetSdrView()->DeleteMarkedPoints();
+ break;
+
+ case( TBI_UNDO ):
+ {
+ nGrfChanged = nGrfChanged ? nGrfChanged-- : 0UL;
+ aRedoGraphic = aGraphic;
+ aGraphic = aUndoGraphic;
+ aUndoGraphic = Graphic();
+ aContourWnd.SetGraphic( aGraphic, sal_False );
+ }
+ break;
+
+ case( TBI_REDO ):
+ {
+ nGrfChanged++;
+ aUndoGraphic = aGraphic;
+ aGraphic = aRedoGraphic;
+ aRedoGraphic = Graphic();
+ aContourWnd.SetGraphic( aGraphic, sal_False );
+ }
+ break;
+
+ case( TBI_AUTOCONTOUR ):
+ aCreateTimer.Start();
+ break;
+
+ case( TBI_PIPETTE ):
+ {
+ sal_Bool bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
+
+ if ( !bPipette )
+ aStbStatus.Invalidate();
+ else if ( bGraphicLinked )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_LINKED ) ) );
+
+ if ( aQBox.Execute() != RET_YES )
+ {
+ aTbx1.CheckItem( TBI_PIPETTE, bPipette = sal_False );
+ aStbStatus.Invalidate();
+ }
+ }
+
+ aContourWnd.SetPipetteMode( bPipette );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Point& rMousePos = pWnd->GetMousePos();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
+ aStr.Append( String::CreateFromAscii( " / " ) );
+ aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 2, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Size& rSize = pWnd->GetGraphicSize();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
+ aStr.Append( String::CreateFromAscii( " x " ) );
+ aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 3, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, UpdateHdl, Timer*, EMPTYARG )
+{
+ aUpdateTimer.Stop();
+
+ if ( pUpdateEditingObject != pCheckObj )
+ {
+ if( !GetEditingObject() )
+ aContourWnd.GrabFocus();
+
+ SetGraphic( aUpdateGraphic );
+ SetPolyPolygon( aUpdatePolyPoly );
+ SetEditingObject( pUpdateEditingObject );
+ bGraphicLinked = bUpdateGraphicLinked;
+
+ aUpdateGraphic = Graphic();
+ aUpdatePolyPoly = PolyPolygon();
+ bUpdateGraphicLinked = sal_False;
+
+ aContourWnd.GetSdrModel()->SetChanged( sal_False );
+ }
+
+ GetBindings().Invalidate( SID_CONTOUR_EXEC );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, CreateHdl, Timer*, EMPTYARG )
+{
+ aCreateTimer.Stop();
+
+ const Rectangle aWorkRect = aContourWnd.LogicToPixel( aContourWnd.GetWorkRect(), MapMode( MAP_100TH_MM ) );
+ const Graphic& rGraphic = aContourWnd.GetGraphic();
+ const sal_Bool bValid = aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom();
+
+ EnterWait();
+ SetPolyPolygon( CreateAutoContour( rGraphic, bValid ? &aWorkRect : NULL ) );
+ LeaveWait();
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, StateHdl, ContourWindow*, pWnd )
+{
+ const SdrObject* pObj = pWnd->GetSelectedSdrObject();
+ const SdrView* pView = pWnd->GetSdrView();
+ const sal_Bool bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
+ const sal_Bool bDrawEnabled = !( bPolyEdit && aTbx1.IsItemChecked( TBI_POLYEDIT ) );
+ const sal_Bool bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
+ const sal_Bool bWorkplace = aTbx1.IsItemChecked( TBI_WORKPLACE );
+ const sal_Bool bDontHide = !( bPipette || bWorkplace );
+ const sal_Bool bBitmap = pWnd->GetGraphic().GetType() == GRAPHIC_BITMAP;
+
+ aTbx1.EnableItem( TBI_APPLY, bDontHide && bExecState && pWnd->IsChanged() );
+
+ aTbx1.EnableItem( TBI_WORKPLACE, !bPipette && bDrawEnabled );
+
+ aTbx1.EnableItem( TBI_SELECT, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_RECT, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_CIRCLE, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLY, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_FREEPOLY, bDontHide && bDrawEnabled );
+
+ aTbx1.EnableItem( TBI_POLYEDIT, bDontHide && bPolyEdit );
+ aTbx1.EnableItem( TBI_POLYMOVE, bDontHide && !bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLYINSERT, bDontHide && !bDrawEnabled );
+ aTbx1.EnableItem( TBI_POLYDELETE, bDontHide && !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
+
+ aTbx1.EnableItem( TBI_AUTOCONTOUR, bDontHide && bDrawEnabled );
+ aTbx1.EnableItem( TBI_PIPETTE, !bWorkplace && bDrawEnabled && bBitmap );
+
+ aTbx1.EnableItem( TBI_UNDO, bDontHide && IsUndoPossible() );
+ aTbx1.EnableItem( TBI_REDO, bDontHide && IsRedoPossible() );
+
+ if ( bPolyEdit )
+ {
+ sal_uInt16 nId = 0;
+
+ switch( pWnd->GetPolyEditMode() )
+ {
+ case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
+ case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
+
+ default:
+ break;
+ }
+
+ aTbx1.CheckItem( nId, sal_True );
+ }
+ else
+ {
+ aTbx1.CheckItem( TBI_POLYEDIT, sal_False );
+ aTbx1.CheckItem( TBI_POLYMOVE, sal_True );
+ aTbx1.CheckItem( TBI_POLYINSERT, sal_False );
+ pWnd->SetPolyEditMode( 0 );
+ }
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, PipetteHdl, ContourWindow*, pWnd )
+{
+ const Color& rOldLineColor = aStbStatus.GetLineColor();
+ const Color& rOldFillColor = aStbStatus.GetFillColor();
+
+ Rectangle aRect( aStbStatus.GetItemRect( 4 ) );
+ const Color& rColor = pWnd->GetPipetteColor();
+
+ aStbStatus.SetLineColor( rColor );
+ aStbStatus.SetFillColor( rColor );
+
+ aRect.Left() += 4;
+ aRect.Top() += 4;
+ aRect.Right() -= 4;
+ aRect.Bottom() -= 4;
+
+ aStbStatus.DrawRect( aRect );
+
+ aStbStatus.SetLineColor( rOldLineColor );
+ aStbStatus.SetFillColor( rOldFillColor );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd )
+{
+ if ( pWnd->IsClickValid() )
+ {
+ Bitmap aMask;
+ const Color& rColor = pWnd->GetPipetteColor();
+
+ EnterWait();
+
+ if( aGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ const long nTol = static_cast<long>(aMtfTolerance.GetValue() * 255L / 100L);
+
+ aMask = aBmp.CreateMask( rColor, nTol );
+
+ if( aGraphic.IsTransparent() )
+ aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BMP_COMBINE_OR );
+
+ if( !!aMask )
+ {
+ QueryBox aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_NEWPIPETTE ) ) );
+ sal_Bool bNewContour;
+
+ aRedoGraphic = Graphic();
+ aUndoGraphic = aGraphic;
+ aGraphic = Graphic( BitmapEx( aBmp, aMask ) );
+ nGrfChanged++;
+
+ bNewContour = ( aQBox.Execute() == RET_YES );
+ pWnd->SetGraphic( aGraphic, bNewContour );
+
+ if( bNewContour )
+ aCreateTimer.Start();
+ }
+ }
+
+ LeaveWait();
+ }
+
+ aTbx1.CheckItem( TBI_PIPETTE, sal_False );
+ pWnd->SetPipetteMode( sal_False );
+ aStbStatus.Invalidate();
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, WorkplaceClickHdl, ContourWindow*, pWnd )
+{
+ aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
+ aTbx1.CheckItem( TBI_SELECT, sal_True );
+ pWnd->SetWorkplaceMode( sal_False );
+
+ return 0L;
+}
+
+void SvxSuperContourDlg::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbx1.SetImageList( rImgLst );
+}
+
+void SvxSuperContourDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxFloatingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxSuperContourDlg, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+
+ return 0L;
+}
+
diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc
new file mode 100644
index 000000000000..99c9eab04b7b
--- /dev/null
+++ b/svx/source/dialog/bmpmask.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RID_SVXDLG_BMPMASK (RID_SVX_BMPMASK_START)
+#define RID_SVXDLG_BMPMASK_STR_TRANSP (RID_SVX_BMPMASK_START + 1)
+#define RID_SVXDLG_BMPMASK_STR_SOURCECOLOR (RID_SVX_BMPMASK_START + 2)
+
+#define GRP_Q 1
+#define CTR_PIPETTE 1
+#define CBX_1 1
+#define CBX_2 4
+#define CBX_3 3
+#define CBX_4 2
+#define CBX_TRANS 5
+#define QCOL_1 2
+#define QCOL_2 5
+#define QCOL_3 4
+#define QCOL_4 3
+#define SP_1 2
+#define SP_2 4
+#define SP_3 1
+#define SP_4 3
+#define GRP_D 2
+#define TBX_PIPETTE 1
+#define TBI_PIPETTE 1
+#define WND_PIPETTE 10
+#define BTN_EXEC 1
+#define LB_1 1
+#define LB_2 2
+#define LB_3 3
+#define LB_4 4
+#define LB_TRANS 5
+#define FT_1 1
+#define FT_2 2
+#define FT_3 3
+#define IMG_PIPETTE 11
+#define IMG_PIPETTE_H 12
+
+
diff --git a/svx/source/dialog/bmpmask.src b/svx/source/dialog/bmpmask.src
new file mode 100644
index 000000000000..7823007dbe7c
--- /dev/null
+++ b/svx/source/dialog/bmpmask.src
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "bmpmask.hrc"
+#include "helpid.hrc"
+
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+
+
+ // RID_SVXDLG_BMPMASK ----------------------------------------------------
+DockingWindow RID_SVXDLG_BMPMASK
+{
+ HelpId = CMD_SID_BMPMASK ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 163 , 126 ) ;
+ Sizeable = FALSE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ FixedLine GRP_Q
+ {
+ Pos = MAP_APPFONT ( 6 , 26 ) ;
+ Size = MAP_APPFONT ( 151 , 8 ) ;
+ Text [ en-US ] = "Colors" ;
+ };
+ FixedText FT_1
+ {
+ Pos = MAP_APPFONT ( 12 , 37 ) ;
+ Size = MAP_APPFONT ( 44 , 8 ) ;
+ Text [ en-US ] = "Source color" ;
+ };
+ FixedText FT_2
+ {
+ Pos = MAP_APPFONT ( 58 , 37 ) ;
+ Size = MAP_APPFONT ( 34 , 8 ) ;
+ Text [ en-US ] = "Tolerance" ;
+ };
+ FixedText FT_3
+ {
+ Pos = MAP_APPFONT ( 93 , 37 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Text [ en-US ] = "Replace with..." ;
+ };
+
+ // line 1
+
+ CheckBox CBX_1
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_1";
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_1
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 48 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_1
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 48 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_1
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 48 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // line 2
+
+ CheckBox CBX_2
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_2";
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_2
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 63 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_2
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 63 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_2
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 63 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // line 3
+
+ CheckBox CBX_3
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_3";
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_3
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 78 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_3
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58, 78 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_3
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 78 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ // Line 4
+
+ CheckBox CBX_4
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_4";
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ Control QCOL_4
+ {
+ HelpId = HID_BMPMASK_CTL_QCOL_1 ;
+ Pos = MAP_APPFONT ( 24 , 93 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ MetricField SP_4
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_BMPMASK:SP_4";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 58 , 93 ) ;
+ Size = MAP_APPFONT ( 29 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ ListBox LB_4
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_4";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 93 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+
+ CheckBox CBX_TRANS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_BMPMASK:CBX_TRANS";
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 71 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Tr~ansparency" ;
+ };
+
+ PushButton BTN_EXEC
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_BMPMASK:BTN_EXEC";
+ Pos = MAP_APPFONT ( 93 , 6 ) ;
+ Size = MAP_APPFONT ( 64 , 14 ) ;
+ Text [ en-US ] = "~Replace" ;
+ };
+
+ ListBox LB_TRANS
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_BMPMASK:LB_TRANS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 93 , 108 ) ;
+ Size = MAP_APPFONT ( 64 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ ToolBox TBX_PIPETTE
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 7 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Identifier = TBI_PIPETTE ;
+ HelpId = HID_BMPMASK_TBI_PIPETTE ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "sc10350.bmp" ; };
+ MASKCOLOR
+ };
+ Text [ en-US ] = "Pipette" ;
+ };
+ };
+ };
+ Control WND_PIPETTE
+ {
+ HelpId = HID_BMPMASK_CTL_PIPETTE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 22 , 6 ) ;
+ Size = MAP_APPFONT ( 43 , 14 ) ;
+ };
+ Text [ en-US ] = "Color Replacer" ;
+
+ Image IMG_PIPETTE
+ {
+ ImageBitmap = Bitmap { File = "sc10350.bmp" ; };
+ MASKCOLOR
+ };
+
+ Image IMG_PIPETTE_H
+ {
+ ImageBitmap = Bitmap { File = "sc10350_h.bmp" ; };
+ MASKCOLOR
+ };
+};
+
+String RID_SVXDLG_BMPMASK_STR_TRANSP
+{
+ Text [ en-US ] = "Transparent";
+};
+
+String RID_SVXDLG_BMPMASK_STR_SOURCECOLOR
+{
+ // This string is used by the eyedropper dialog to denote a color in an image
+ // that will be replaced by another color.
+ Text [ en-US ] = "Source Color";
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
new file mode 100644
index 000000000000..b86121412ab7
--- /dev/null
+++ b/svx/source/dialog/charmap.cxx
@@ -0,0 +1,893 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <stdio.h>
+
+#define _SVX_CHARMAP_CXX_
+#include <vcl/svapp.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include <rtl/textenc.h>
+#include <svx/ucsubset.hxx>
+
+#include <svx/dialogs.hrc>
+
+#include <svx/charmap.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/svxdlg.hxx>
+
+#include "charmapacc.hxx"
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <comphelper/types.hxx>
+#include <svl/itemset.hxx>
+
+#include "rtl/ustrbuf.hxx"
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+sal_uInt32& SvxShowCharSet::getSelectedChar()
+{
+ static sal_uInt32 cSelectedChar = ' '; // keeps selected character over app livetime
+ return cSelectedChar;
+}
+
+// class SvxShowCharSet ==================================================
+
+#define SBWIDTH 16
+
+SvxShowCharSet::SvxShowCharSet( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+ ,m_pAccessible(NULL)
+ ,aVscrollSB( this, WB_VERT)
+{
+ nSelectedIndex = -1; // TODO: move into init list when it is no longer static
+
+ aOrigSize = GetOutputSizePixel();
+ aOrigPos = GetPosPixel();
+
+ SetStyle( GetStyle() | WB_CLIPCHILDREN );
+ aVscrollSB.SetScrollHdl( LINK( this, SvxShowCharSet, VscrollHdl ) );
+ aVscrollSB.EnableDrag( sal_True );
+ // other settings like aVscroll depend on selected font => see SetFont
+
+ bDrag = sal_False;
+ InitSettings( sal_True, sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::GetFocus()
+{
+ Control::GetFocus();
+ SelectIndex( nSelectedIndex, sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::LoseFocus()
+{
+ Control::LoseFocus();
+ SelectIndex( nSelectedIndex, sal_False );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS )
+ && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.GetClicks() == 1 )
+ {
+ GrabFocus();
+ bDrag = sal_True;
+ CaptureMouse();
+
+ int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
+ SelectIndex( nIndex );
+ }
+
+ if ( !(rMEvt.GetClicks() % 2) )
+ aDoubleClkHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( bDrag && rMEvt.IsLeft() )
+ {
+ // released mouse over character map
+ if ( Rectangle(Point(), GetOutputSize()).IsInside(rMEvt.GetPosPixel()))
+ aSelectHdl.Call( this );
+ ReleaseMouse();
+ bDrag = sal_False;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && bDrag )
+ {
+ Point aPos = rMEvt.GetPosPixel();
+ Size aSize = GetSizePixel();
+
+ if ( aPos.X() < 0 )
+ aPos.X() = 0;
+ else if ( aPos.X() > aSize.Width()-5 )
+ aPos.X() = aSize.Width()-5;
+ if ( aPos.Y() < 0 )
+ aPos.Y() = 0;
+ else if ( aPos.Y() > aSize.Height()-5 )
+ aPos.Y() = aSize.Height()-5;
+
+ int nIndex = PixelToMapIndex( aPos );
+ SelectIndex( nIndex );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::Command( const CommandEvent& rCEvt )
+{
+ if( !HandleScrollCommand( rCEvt, 0, &aVscrollSB ) )
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SvxShowCharSet::GetRowPos(sal_uInt16 _nPos) const
+{
+ return _nPos / COLUMN_COUNT ;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_uInt16 SvxShowCharSet::GetColumnPos(sal_uInt16 _nPos) const
+{
+ return _nPos % COLUMN_COUNT ;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxShowCharSet::FirstInView( void ) const
+{
+ int nIndex = 0;
+ if( aVscrollSB.IsVisible() )
+ nIndex += aVscrollSB.GetThumbPos() * COLUMN_COUNT;
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------
+
+int SvxShowCharSet::LastInView( void ) const
+{
+ sal_uIntPtr nIndex = FirstInView();
+ nIndex += ROW_COUNT * COLUMN_COUNT - 1;
+ sal_uIntPtr nCompare = sal::static_int_cast<sal_uIntPtr>( maFontCharMap.GetCharCount() - 1 );
+ if( nIndex > nCompare )
+ nIndex = nCompare;
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------
+
+inline Point SvxShowCharSet::MapIndexToPixel( int nIndex ) const
+{
+ const int nBase = FirstInView();
+ int x = ((nIndex - nBase) % COLUMN_COUNT) * nX;
+ int y = ((nIndex - nBase) / COLUMN_COUNT) * nY;
+ return Point( x, y );
+}
+// -----------------------------------------------------------------------------
+
+int SvxShowCharSet::PixelToMapIndex( const Point& point) const
+{
+ int nBase = FirstInView();
+ return (nBase + (point.X()/nX) + (point.Y()/nY) * COLUMN_COUNT);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if( aCode.GetModifier() )
+ {
+ Control::KeyInput( rKEvt );
+ return;
+ }
+
+ int tmpSelected = nSelectedIndex;
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ aSelectHdl.Call( this );
+ break;
+ case KEY_LEFT:
+ --tmpSelected;
+ break;
+ case KEY_RIGHT:
+ ++tmpSelected;
+ break;
+ case KEY_UP:
+ tmpSelected -= COLUMN_COUNT;
+ break;
+ case KEY_DOWN:
+ tmpSelected += COLUMN_COUNT;
+ break;
+ case KEY_PAGEUP:
+ tmpSelected -= ROW_COUNT * COLUMN_COUNT;
+ break;
+ case KEY_PAGEDOWN:
+ tmpSelected += ROW_COUNT * COLUMN_COUNT;
+ break;
+ case KEY_HOME:
+ tmpSelected = 0;
+ break;
+ case KEY_END:
+ tmpSelected = maFontCharMap.GetCharCount() - 1;
+ break;
+ case KEY_TAB: // some fonts have a character at these unicode control codes
+ case KEY_ESCAPE:
+ case KEY_RETURN:
+ Control::KeyInput( rKEvt );
+ tmpSelected = - 1; // mark as invalid
+ break;
+ default:
+ {
+ sal_UCS4 cChar = rKEvt.GetCharCode();
+ sal_UCS4 cNext = maFontCharMap.GetNextChar( cChar - 1 );
+ tmpSelected = maFontCharMap.GetIndexFromChar( cNext );
+ if( tmpSelected < 0 || (cChar != cNext) )
+ {
+ Control::KeyInput( rKEvt );
+ tmpSelected = - 1; // mark as invalid
+ }
+ }
+ }
+
+ if ( tmpSelected >= 0 )
+ {
+ SelectIndex( tmpSelected, sal_True );
+ aPreSelectHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::Paint( const Rectangle& )
+{
+ DrawChars_Impl( FirstInView(), LastInView() );
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::DeSelect()
+{
+ DrawChars_Impl(nSelectedIndex,nSelectedIndex);
+}
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::DrawChars_Impl( int n1, int n2 )
+{
+ if( n1 > LastInView() || n2 < FirstInView() )
+ return;
+
+ Size aOutputSize = GetOutputSizePixel();
+ if( aVscrollSB.IsVisible() )
+ aOutputSize.setWidth( aOutputSize.Width() - SBWIDTH );
+
+ int i;
+ for ( i = 1; i < COLUMN_COUNT; ++i )
+ DrawLine( Point( nX * i, 0 ), Point( nX * i, aOutputSize.Height() ) );
+ for ( i = 1; i < ROW_COUNT; ++i )
+ DrawLine( Point( 0, nY * i ), Point( aOutputSize.Width(), nY * i ) );
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ const Color aWindowTextColor( rStyleSettings.GetFieldTextColor() );
+ Color aHighlightColor( rStyleSettings.GetHighlightColor() );
+ Color aHighlightTextColor( rStyleSettings.GetHighlightTextColor() );
+ Color aFaceColor( rStyleSettings.GetFaceColor() );
+ Color aLightColor( rStyleSettings.GetLightColor() );
+ Color aShadowColor( rStyleSettings.GetShadowColor() );
+
+ int nTextHeight = GetTextHeight();
+ Rectangle aBoundRect;
+ for( i = n1; i <= n2; ++i )
+ {
+ Point pix = MapIndexToPixel( i );
+ int x = pix.X();
+ int y = pix.Y();
+
+ rtl::OUStringBuffer buf;
+ buf.appendUtf32( maFontCharMap.GetCharFromIndex( i ) );
+ String aCharStr(buf.makeStringAndClear());
+ int nTextWidth = GetTextWidth(aCharStr);
+ int tx = x + (nX - nTextWidth + 1) / 2;
+ int ty = y + (nY - nTextHeight + 1) / 2;
+ Point aPointTxTy( tx, ty );
+
+ // adjust position before it gets out of bounds
+ if( GetTextBoundRect( aBoundRect, aCharStr ) && !aBoundRect.IsEmpty() )
+ {
+ // zero advance width => use ink width to center glyph
+ if( !nTextWidth )
+ {
+ aPointTxTy.X() = x - aBoundRect.Left()
+ + (nX - aBoundRect.GetWidth() + 1) / 2;
+ }
+
+ aBoundRect += aPointTxTy;
+
+ // shift back vertically if needed
+ int nYLDelta = aBoundRect.Top() - y;
+ int nYHDelta = (y + nY) - aBoundRect.Bottom();
+ if( nYLDelta <= 0 )
+ aPointTxTy.Y() -= nYLDelta - 1;
+ else if( nYHDelta <= 0 )
+ aPointTxTy.Y() += nYHDelta - 1;
+
+ // shift back horizontally if needed
+ int nXLDelta = aBoundRect.Left() - x;
+ int nXHDelta = (x + nX) - aBoundRect.Right();
+ if( nXLDelta <= 0 )
+ aPointTxTy.X() -= nXLDelta - 1;
+ else if( nXHDelta <= 0 )
+ aPointTxTy.X() += nXHDelta - 1;
+ }
+
+ Color aTextCol = GetTextColor();
+ if ( i != nSelectedIndex )
+ {
+ SetTextColor( aWindowTextColor );
+ DrawText( aPointTxTy, aCharStr );
+ }
+ else
+ {
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ Point aPointUL( x + 1, y + 1 );
+ if( HasFocus() )
+ {
+ SetFillColor( aHighlightColor );
+ DrawRect( Rectangle( aPointUL, Size(nX-1,nY-1) ) );
+
+ SetTextColor( aHighlightTextColor );
+ DrawText( aPointTxTy, aCharStr );
+ }
+ else
+ {
+ SetFillColor( aFaceColor );
+ DrawRect( Rectangle( aPointUL, Size( nX-1, nY-1) ) );
+
+ SetLineColor( aLightColor );
+ DrawLine( aPointUL, Point( x+nX-1, y+1) );
+ DrawLine( aPointUL, Point( x+1, y+nY-1) );
+
+ SetLineColor( aShadowColor );
+ DrawLine( Point( x+1, y+nY-1), Point( x+nX-1, y+nY-1) );
+ DrawLine( Point( x+nX-1, y+nY-1), Point( x+nX-1, y+1) );
+
+ DrawText( aPointTxTy, aCharStr );
+ }
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+ SetTextColor( aTextCol );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if ( bForeground )
+ {
+ Color aTextColor( rStyleSettings.GetDialogTextColor() );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+sal_UCS4 SvxShowCharSet::GetSelectCharacter() const
+{
+ if( nSelectedIndex >= 0 )
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+ return getSelectedChar();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SetFont( const Font& rFont )
+{
+ // save last selected unicode
+ if( nSelectedIndex >= 0 )
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+
+ Font aFont = rFont;
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aFont.SetAlign( ALIGN_TOP );
+ int nFontHeight = (aOrigSize.Height() - 5) * 2 / (3 * ROW_COUNT);
+ aFont.SetSize( PixelToLogic( Size( 0, nFontHeight ) ) );
+ aFont.SetTransparent( sal_True );
+ Control::SetFont( aFont );
+ GetFontCharMap( maFontCharMap );
+
+ // hide scrollbar when there is nothing to scroll
+ sal_Bool bNeedVscroll = (maFontCharMap.GetCharCount() > ROW_COUNT*COLUMN_COUNT);
+
+ nX = (aOrigSize.Width() - (bNeedVscroll ? SBWIDTH : 0)) / COLUMN_COUNT;
+ nY = aOrigSize.Height() / ROW_COUNT;
+
+ if( bNeedVscroll)
+ {
+ aVscrollSB.SetPosSizePixel( nX * COLUMN_COUNT, 0, SBWIDTH, nY * ROW_COUNT );
+ aVscrollSB.SetRangeMin( 0 );
+ int nLastRow = (maFontCharMap.GetCharCount() - 1 + COLUMN_COUNT) / COLUMN_COUNT;
+ aVscrollSB.SetRangeMax( nLastRow );
+ aVscrollSB.SetPageSize( ROW_COUNT-1 );
+ aVscrollSB.SetVisibleSize( ROW_COUNT );
+ }
+
+ // restore last selected unicode
+ int nMapIndex = maFontCharMap.GetIndexFromChar( getSelectedChar() );
+ SelectIndex( nMapIndex );
+
+ // rearrange CharSet element in sync with nX- and nY-multiples
+ Size aNewSize( nX * COLUMN_COUNT + (bNeedVscroll ? SBWIDTH : 0), nY * ROW_COUNT );
+ Point aNewPos = aOrigPos + Point( (aOrigSize.Width() - aNewSize.Width()) / 2, 0 );
+ SetPosPixel( aNewPos );
+ SetOutputSizePixel( aNewSize );
+
+ aVscrollSB.Show( bNeedVscroll );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SelectIndex( int nNewIndex, sal_Bool bFocus )
+{
+ if( nNewIndex < 0 )
+ {
+ // need to scroll see closest unicode
+ sal_uInt32 cPrev = maFontCharMap.GetPrevChar( getSelectedChar() );
+ int nMapIndex = maFontCharMap.GetIndexFromChar( cPrev );
+ int nNewPos = nMapIndex / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nNewPos );
+ nSelectedIndex = bFocus ? nMapIndex+1 : -1;
+ Invalidate();
+ Update();
+ }
+ else if( nNewIndex < FirstInView() )
+ {
+ // need to scroll up to see selected item
+ int nOldPos = aVscrollSB.GetThumbPos();
+ int nDelta = (FirstInView() - nNewIndex + COLUMN_COUNT-1) / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nOldPos - nDelta );
+ nSelectedIndex = nNewIndex;
+ Invalidate();
+ if( nDelta )
+ Update();
+ }
+ else if( nNewIndex > LastInView() )
+ {
+ // need to scroll down to see selected item
+ int nOldPos = aVscrollSB.GetThumbPos();
+ int nDelta = (nNewIndex - LastInView() + COLUMN_COUNT) / COLUMN_COUNT;
+ aVscrollSB.SetThumbPos( nOldPos + nDelta );
+ if( nNewIndex < maFontCharMap.GetCharCount() )
+ {
+ nSelectedIndex = nNewIndex;
+ Invalidate();
+ }
+ if( nOldPos != aVscrollSB.GetThumbPos() )
+ {
+ Invalidate();
+ Update();
+ }
+ }
+ else
+ {
+ // remove highlighted view
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( GetBackground().GetColor() );
+
+ Point aOldPixel = MapIndexToPixel( nSelectedIndex );
+ aOldPixel.Move( +1, +1);
+ DrawRect( Rectangle( aOldPixel, Size( nX-1, nY-1 ) ) );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+
+ int nOldIndex = nSelectedIndex;
+ nSelectedIndex = nNewIndex;
+ DrawChars_Impl( nOldIndex, nOldIndex );
+ DrawChars_Impl( nNewIndex, nNewIndex );
+ }
+
+ if( nSelectedIndex >= 0 )
+ {
+ getSelectedChar() = maFontCharMap.GetCharFromIndex( nSelectedIndex );
+ if( m_pAccessible )
+ {
+ ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
+ m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
+
+ OSL_ENSURE(pItem->m_pItem,"No accessible created!");
+ Any aOldAny, aNewAny;
+ aNewAny <<= AccessibleStateType::FOCUSED;
+ pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
+
+ aNewAny <<= AccessibleStateType::SELECTED;
+ pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
+ }
+ }
+
+
+ aHighHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, sal_Bool bFocus )
+{
+ // get next available char of current font
+ sal_UCS4 cNext = maFontCharMap.GetNextChar( cNew - 1 );
+
+ int nMapIndex = maFontCharMap.GetIndexFromChar( cNext );
+ SelectIndex( nMapIndex, bFocus );
+ if( !bFocus )
+ {
+ // move selected item to top row if not in focus
+ aVscrollSB.SetThumbPos( nMapIndex / COLUMN_COUNT );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxShowCharSet, VscrollHdl, ScrollBar *, EMPTYARG )
+{
+ if( nSelectedIndex < FirstInView() )
+ {
+ SelectIndex( FirstInView() + (nSelectedIndex % COLUMN_COUNT) );
+ }
+ else if( nSelectedIndex > LastInView() )
+ {
+ if( m_pAccessible )
+ {
+ ::com::sun::star::uno::Any aOldAny, aNewAny;
+ int nLast = LastInView();
+ for ( ; nLast != nSelectedIndex; ++nLast)
+ {
+ aOldAny <<= ImplGetItem(nLast)->GetAccessible();
+ m_pAccessible ->fireEvent( AccessibleEventId::CHILD, aOldAny, aNewAny );
+ }
+ }
+ SelectIndex( (LastInView() - COLUMN_COUNT + 1) + (nSelectedIndex % COLUMN_COUNT) );
+ }
+
+ Invalidate();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxShowCharSet::~SvxShowCharSet()
+{
+ if ( m_pAccessible )
+ ReleaseAccessible();
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::ReleaseAccessible()
+{
+ m_aItems.clear();
+ m_pAccessible = NULL;
+ m_xAccessible = NULL;
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< XAccessible > SvxShowCharSet::CreateAccessible()
+{
+ OSL_ENSURE(!m_pAccessible,"Accessible already created!");
+ m_pAccessible = new ::svx::SvxShowCharSetVirtualAcc(this);
+ m_xAccessible = m_pAccessible;
+ return m_xAccessible;
+}
+// -----------------------------------------------------------------------------
+::svx::SvxShowCharSetItem* SvxShowCharSet::ImplGetItem( int _nPos )
+{
+ ItemsMap::iterator aFind = m_aItems.find(_nPos);
+ if ( aFind == m_aItems.end() )
+ {
+ OSL_ENSURE(m_pAccessible,"Who wants to create a child of my table without a parent?");
+ aFind = m_aItems.insert(ItemsMap::value_type(_nPos,new ::svx::SvxShowCharSetItem(*this,m_pAccessible->getTable(),sal::static_int_cast< sal_uInt16 >(_nPos)))).first;
+ rtl::OUStringBuffer buf;
+ buf.appendUtf32( maFontCharMap.GetCharFromIndex( _nPos ) );
+ aFind->second->maText = buf.makeStringAndClear();
+ Point pix = MapIndexToPixel( _nPos );
+ aFind->second->maRect = Rectangle( Point( pix.X() + 1, pix.Y() + 1 ), Size(nX-1,nY-1) );
+ }
+
+ return aFind->second;
+}
+// -----------------------------------------------------------------------------
+void SvxShowCharSet::ImplFireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue )
+{
+ if( m_pAccessible )
+ m_pAccessible->fireEvent( nEventId, rOldValue, rNewValue );
+}
+// -----------------------------------------------------------------------------
+ScrollBar* SvxShowCharSet::getScrollBar()
+{
+ return &aVscrollSB;
+}
+// -----------------------------------------------------------------------
+sal_Int32 SvxShowCharSet::getMaxCharCount() const
+{
+ return maFontCharMap.GetCharCount();
+}
+
+
+// class SubsetMap =======================================================
+// TODO: should be moved into Font Attributes stuff
+// we let it mature here though because it is currently the only use
+
+SubsetMap::SubsetMap( const FontCharMap* pFontCharMap )
+: Resource( SVX_RES(RID_SUBSETMAP) )
+{
+ InitList();
+ ApplyCharMap( pFontCharMap );
+ FreeResource();
+}
+
+const Subset* SubsetMap::GetNextSubset( bool bFirst ) const
+{
+ if( bFirst )
+ maSubsetIterator = maSubsets.begin();
+ if( maSubsetIterator == maSubsets.end() )
+ return NULL;
+ const Subset* s = &*(maSubsetIterator++);
+ return s;
+}
+
+const Subset* SubsetMap::GetSubsetByUnicode( sal_UCS4 cChar ) const
+{
+ // TODO: is it worth to avoid a linear search?
+ for( const Subset* s = GetNextSubset( true ); s; s = GetNextSubset( false ) )
+ if( (s->GetRangeMin() <= cChar) && (cChar <= s->GetRangeMax()) )
+ return s;
+ return NULL;
+}
+
+inline Subset::Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId)
+: mnRangeMin(nMin), mnRangeMax(nMax), maRangeName( SVX_RES(resId) )
+{}
+
+void SubsetMap::InitList()
+{
+ static SubsetList aAllSubsets;
+ static bool bInit = true;
+ if( bInit )
+ {
+ bInit = false;
+
+ // TODO: eventually merge or split unicode subranges
+ // a "native writer" should decide for his subsets
+ aAllSubsets.push_back( Subset( 0x0020, 0x007F, RID_SUBSETSTR_BASIC_LATIN ) );
+ aAllSubsets.push_back( Subset( 0x0080, 0x00FF, RID_SUBSETSTR_LATIN_1 ) );
+ aAllSubsets.push_back( Subset( 0x0100, 0x017F, RID_SUBSETSTR_LATIN_EXTENDED_A ) );
+ aAllSubsets.push_back( Subset( 0x0180, 0x024F, RID_SUBSETSTR_LATIN_EXTENDED_B ) );
+ aAllSubsets.push_back( Subset( 0x0250, 0x02AF, RID_SUBSETSTR_IPA_EXTENSIONS ) );
+ aAllSubsets.push_back( Subset( 0x02B0, 0x02FF, RID_SUBSETSTR_SPACING_MODIFIERS ) );
+ aAllSubsets.push_back( Subset( 0x0300, 0x036F, RID_SUBSETSTR_COMB_DIACRITICAL ) );
+ aAllSubsets.push_back( Subset( 0x0370, 0x03FF, RID_SUBSETSTR_BASIC_GREEK ) );
+ // aAllSubsets.push_back( Subset( 0x03D0, 0x03F3, RID_SUBSETSTR_GREEK_SYMS_COPTIC ) );
+ aAllSubsets.push_back( Subset( 0x0400, 0x04FF, RID_SUBSETSTR_CYRILLIC ) );
+ aAllSubsets.push_back( Subset( 0x0530, 0x058F, RID_SUBSETSTR_ARMENIAN ) );
+ aAllSubsets.push_back( Subset( 0x0590, 0x05FF, RID_SUBSETSTR_BASIC_HEBREW ) );
+ // aAllSubsets.push_back( Subset( 0x0591, 0x05C4, RID_SUBSETSTR_HEBREW_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x0600, 0x065F, RID_SUBSETSTR_BASIC_ARABIC ) );
+ aAllSubsets.push_back( Subset( 0x0660, 0x06FF, RID_SUBSETSTR_ARABIC_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x0700, 0x074F, RID_SUBSETSTR_SYRIAC ) );
+ aAllSubsets.push_back( Subset( 0x0780, 0x07BF, RID_SUBSETSTR_THAANA ) );
+ aAllSubsets.push_back( Subset( 0x0900, 0x097F, RID_SUBSETSTR_DEVANAGARI ) );
+ aAllSubsets.push_back( Subset( 0x0980, 0x09FF, RID_SUBSETSTR_BENGALI ) );
+ aAllSubsets.push_back( Subset( 0x0A00, 0x0A7F, RID_SUBSETSTR_GURMUKHI ) );
+ aAllSubsets.push_back( Subset( 0x0A80, 0x0AFF, RID_SUBSETSTR_GUJARATI ) );
+ aAllSubsets.push_back( Subset( 0x0B00, 0x0B7F, RID_SUBSETSTR_ORIYA ) );
+ aAllSubsets.push_back( Subset( 0x0B80, 0x0BFF, RID_SUBSETSTR_TAMIL ) );
+ aAllSubsets.push_back( Subset( 0x0C00, 0x0C7F, RID_SUBSETSTR_TELUGU ) );
+ aAllSubsets.push_back( Subset( 0x0C80, 0x0CFF, RID_SUBSETSTR_KANNADA ) );
+ aAllSubsets.push_back( Subset( 0x0D00, 0x0D7F, RID_SUBSETSTR_MALAYALAM ) );
+ aAllSubsets.push_back( Subset( 0x0D80, 0x0DFF, RID_SUBSETSTR_SINHALA ) );
+ aAllSubsets.push_back( Subset( 0x0E00, 0x0E7F, RID_SUBSETSTR_THAI ) );
+ aAllSubsets.push_back( Subset( 0x0E80, 0x0EFF, RID_SUBSETSTR_LAO ) );
+ aAllSubsets.push_back( Subset( 0x0F00, 0x0FBF, RID_SUBSETSTR_TIBETAN ) );
+ aAllSubsets.push_back( Subset( 0x1000, 0x109F, RID_SUBSETSTR_MYANMAR ) );
+ aAllSubsets.push_back( Subset( 0x10A0, 0x10FF, RID_SUBSETSTR_BASIC_GEORGIAN ) );
+ // aAllSubsets.push_back( Subset( 0x10A0, 0x10C5, RID_SUBSETSTR_GEORGIAN_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x1100, 0x11FF, RID_SUBSETSTR_HANGUL_JAMO ) );
+ aAllSubsets.push_back( Subset( 0x1200, 0x137F, RID_SUBSETSTR_ETHIOPIC ) );
+ aAllSubsets.push_back( Subset( 0x13A0, 0x13FF, RID_SUBSETSTR_CHEROKEE ) );
+ aAllSubsets.push_back( Subset( 0x1400, 0x167F, RID_SUBSETSTR_CANADIAN_ABORIGINAL ) );
+ aAllSubsets.push_back( Subset( 0x1680, 0x169F, RID_SUBSETSTR_OGHAM ) );
+ aAllSubsets.push_back( Subset( 0x16A0, 0x16F0, RID_SUBSETSTR_RUNIC ) );
+ aAllSubsets.push_back( Subset( 0x1700, 0x171F, RID_SUBSETSTR_TAGALOG ) );
+ aAllSubsets.push_back( Subset( 0x1720, 0x173F, RID_SUBSETSTR_HANUNOO ) );
+ aAllSubsets.push_back( Subset( 0x1740, 0x175F, RID_SUBSETSTR_BUHID ) );
+ aAllSubsets.push_back( Subset( 0x1760, 0x177F, RID_SUBSETSTR_TAGBANWA ) );
+ aAllSubsets.push_back( Subset( 0x1780, 0x17FF, RID_SUBSETSTR_KHMER ) );
+ aAllSubsets.push_back( Subset( 0x1800, 0x18AF, RID_SUBSETSTR_MONGOLIAN ) );
+ aAllSubsets.push_back( Subset( 0x1E00, 0x1EFF, RID_SUBSETSTR_LATIN_EXTENDED_ADDS ) );
+ aAllSubsets.push_back( Subset( 0x1F00, 0x1FFF, RID_SUBSETSTR_GREEK_EXTENDED ) );
+
+ aAllSubsets.push_back( Subset( 0x2000, 0x206F, RID_SUBSETSTR_GENERAL_PUNCTUATION ) );
+ aAllSubsets.push_back( Subset( 0x2070, 0x209F, RID_SUBSETSTR_SUB_SUPER_SCRIPTS ) );
+ aAllSubsets.push_back( Subset( 0x20A0, 0x20CF, RID_SUBSETSTR_CURRENCY_SYMBOLS ) );
+ aAllSubsets.push_back( Subset( 0x20D0, 0x20FF, RID_SUBSETSTR_COMB_DIACRITIC_SYMS ) );
+ aAllSubsets.push_back( Subset( 0x2100, 0x214F, RID_SUBSETSTR_LETTERLIKE_SYMBOLS ) );
+ aAllSubsets.push_back( Subset( 0x2150, 0x218F, RID_SUBSETSTR_NUMBER_FORMS ) );
+ aAllSubsets.push_back( Subset( 0x2190, 0x21FF, RID_SUBSETSTR_ARROWS ) );
+ aAllSubsets.push_back( Subset( 0x2200, 0x22FF, RID_SUBSETSTR_MATH_OPERATORS ) );
+ aAllSubsets.push_back( Subset( 0x2300, 0x23FF, RID_SUBSETSTR_MISC_TECHNICAL ) );
+ aAllSubsets.push_back( Subset( 0x2400, 0x243F, RID_SUBSETSTR_CONTROL_PICTURES ) );
+ aAllSubsets.push_back( Subset( 0x2440, 0x245F, RID_SUBSETSTR_OPTICAL_CHAR_REC ) );
+ aAllSubsets.push_back( Subset( 0x2460, 0x24FF, RID_SUBSETSTR_ENCLOSED_ALPHANUM ) );
+ aAllSubsets.push_back( Subset( 0x2500, 0x257F, RID_SUBSETSTR_BOX_DRAWING ) );
+ aAllSubsets.push_back( Subset( 0x2580, 0x259F, RID_SUBSETSTR_BLOCK_ELEMENTS ) );
+ aAllSubsets.push_back( Subset( 0x25A0, 0x25FF, RID_SUBSETSTR_GEOMETRIC_SHAPES ) );
+ aAllSubsets.push_back( Subset( 0x2600, 0x26FF, RID_SUBSETSTR_MISC_DINGBATS ) );
+ aAllSubsets.push_back( Subset( 0x2700, 0x27BF, RID_SUBSETSTR_DINGBATS ) );
+
+ aAllSubsets.push_back( Subset( 0x27C0, 0x27FF, RID_SUBSETSTR_MISC_MATH_SYMS_A ) );
+ aAllSubsets.push_back( Subset( 0x27F0, 0x27FF, RID_SUBSETSTR_SUPPL_ARROWS_A ) );
+ aAllSubsets.push_back( Subset( 0x2800, 0x28FF, RID_SUBSETSTR_BRAILLE_PATTERNS ) );
+ aAllSubsets.push_back( Subset( 0x2900, 0x297F, RID_SUBSETSTR_SUPPL_ARROWS_B ) );
+ aAllSubsets.push_back( Subset( 0x2980, 0x29FF, RID_SUBSETSTR_MISC_MATH_SYMS_B ) );
+ aAllSubsets.push_back( Subset( 0x2E80, 0x2EFF, RID_SUBSETSTR_CJK_RADICAL_SUPPL ) );
+ aAllSubsets.push_back( Subset( 0x2F00, 0x2FDF, RID_SUBSETSTR_KANXI_RADICALS ) );
+ aAllSubsets.push_back( Subset( 0x2FF0, 0x2FFF, RID_SUBSETSTR_IDEO_DESC_CHARS ) );
+
+ aAllSubsets.push_back( Subset( 0x3000, 0x303F, RID_SUBSETSTR_CJK_SYMS_PUNCTUATION ) );
+ aAllSubsets.push_back( Subset( 0x3040, 0x309F, RID_SUBSETSTR_HIRAGANA ) );
+ aAllSubsets.push_back( Subset( 0x30A0, 0x30FF, RID_SUBSETSTR_KATAKANA ) );
+ aAllSubsets.push_back( Subset( 0x3100, 0x312F, RID_SUBSETSTR_BOPOMOFO ) );
+ aAllSubsets.push_back( Subset( 0x3130, 0x318F, RID_SUBSETSTR_HANGUL_COMPAT_JAMO ) );
+ aAllSubsets.push_back( Subset( 0x3190, 0x319F, RID_SUBSETSTR_KANBUN ) );
+ aAllSubsets.push_back( Subset( 0x31A0, 0x31BF, RID_SUBSETSTR_BOPOMOFO_EXTENDED ) );
+ aAllSubsets.push_back( Subset( 0x31C0, 0x31FF, RID_SUBSETSTR_KATAKANA_PHONETIC ) );
+ aAllSubsets.push_back( Subset( 0x3200, 0x32FF, RID_SUBSETSTR_ENCLOSED_CJK_LETTERS ) );
+ aAllSubsets.push_back( Subset( 0x3300, 0x33FF, RID_SUBSETSTR_CJK_COMPATIBILITY ) );
+
+ aAllSubsets.push_back( Subset( 0x3400, 0x4DFF, RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH ) );
+ aAllSubsets.push_back( Subset( 0x4E00, 0x9FA5, RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH ) );
+ aAllSubsets.push_back( Subset( 0xA000, 0xA4CF, RID_SUBSETSTR_YI ) );
+ aAllSubsets.push_back( Subset( 0xAC00, 0xB097, RID_SUBSETSTR_HANGUL_GA ) );
+ aAllSubsets.push_back( Subset( 0xB098, 0xB2E3, RID_SUBSETSTR_HANGUL_NA ) );
+ aAllSubsets.push_back( Subset( 0xB2E4, 0xB77B, RID_SUBSETSTR_HANGUL_DA ) );
+ aAllSubsets.push_back( Subset( 0xB77C, 0xB9C7, RID_SUBSETSTR_HANGUL_RA ) );
+ aAllSubsets.push_back( Subset( 0xB9C8, 0xBC13, RID_SUBSETSTR_HANGUL_MA ) );
+ aAllSubsets.push_back( Subset( 0xBC14, 0xC0AB, RID_SUBSETSTR_HANGUL_BA ) );
+ aAllSubsets.push_back( Subset( 0xC0AC, 0xC543, RID_SUBSETSTR_HANGUL_SA ) );
+ aAllSubsets.push_back( Subset( 0xC544, 0xC78F, RID_SUBSETSTR_HANGUL_AH ) );
+ aAllSubsets.push_back( Subset( 0xC790, 0xCC27, RID_SUBSETSTR_HANGUL_JA ) );
+ aAllSubsets.push_back( Subset( 0xCC28, 0xCE73, RID_SUBSETSTR_HANGUL_CHA ) );
+ aAllSubsets.push_back( Subset( 0xCE74, 0xD0BF, RID_SUBSETSTR_HANGUL_KA ) );
+ aAllSubsets.push_back( Subset( 0xD0C0, 0xD30B, RID_SUBSETSTR_HANGUL_TA ) );
+ aAllSubsets.push_back( Subset( 0xD30C, 0xD557, RID_SUBSETSTR_HANGUL_PA ) );
+ aAllSubsets.push_back( Subset( 0xD558, 0xD7A3, RID_SUBSETSTR_HANGUL_HA ) );
+ // aAllSubsets.push_back( Subset( 0xAC00, 0xD7AF, RID_SUBSETSTR_HANGUL ) );
+
+ // aAllSubsets.push_back( Subset( 0xD800, 0xDFFF, RID_SUBSETSTR_SURROGATE ) );
+ aAllSubsets.push_back( Subset( 0xE000, 0xF8FF, RID_SUBSETSTR_PRIVATE_USE_AREA ) );
+ aAllSubsets.push_back( Subset( 0xF900, 0xFAFF, RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS ) );
+ aAllSubsets.push_back( Subset( 0xFB00, 0xFB4F, RID_SUBSETSTR_ALPHA_PRESENTATION ) );
+ aAllSubsets.push_back( Subset( 0xFB50, 0xFDFF, RID_SUBSETSTR_ARABIC_PRESENT_A ) );
+ aAllSubsets.push_back( Subset( 0xFE20, 0xFE2F, RID_SUBSETSTR_COMBINING_HALF_MARKS ) );
+ aAllSubsets.push_back( Subset( 0xFE30, 0xFE4F, RID_SUBSETSTR_CJK_COMPAT_FORMS ) );
+ aAllSubsets.push_back( Subset( 0xFE50, 0xFE6F, RID_SUBSETSTR_SMALL_FORM_VARIANTS ) );
+ aAllSubsets.push_back( Subset( 0xFE70, 0xFEFF, RID_SUBSETSTR_ARABIC_PRESENT_B ) );
+ aAllSubsets.push_back( Subset( 0xFF00, 0xFFEF, RID_SUBSETSTR_HALFW_FULLW_FORMS ) );
+ aAllSubsets.push_back( Subset( 0xFFF0, 0xFFFF, RID_SUBSETSTR_SPECIALS ) );
+ }
+
+ maSubsets = aAllSubsets;
+}
+
+void SubsetMap::ApplyCharMap( const FontCharMap* pFontCharMap )
+{
+ if( !pFontCharMap )
+ return;
+
+ // remove subsets that are not matched in any range
+ SubsetList::iterator it_next = maSubsets.begin();
+ while( it_next != maSubsets.end() )
+ {
+ SubsetList::iterator it = it_next++;
+ const Subset& rSubset = *it;
+ sal_uInt32 cMin = rSubset.GetRangeMin();
+ sal_uInt32 cMax = rSubset.GetRangeMax();
+
+ int nCount = pFontCharMap->CountCharsInRange( cMin, cMax );
+ if( nCount <= 0 )
+ maSubsets.erase( it );
+ }
+}
diff --git a/svx/source/dialog/checklbx.cxx b/svx/source/dialog/checklbx.cxx
new file mode 100644
index 000000000000..0a54e3464730
--- /dev/null
+++ b/svx/source/dialog/checklbx.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+
+#define _SVX_CHECKLBX_CXX
+
+#include <svx/checklbx.hxx>
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+
+// class SvxCheckListBox -------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, WinBits nWinStyle ) :
+
+ SvTreeListBox( pParent, nWinStyle )
+
+{
+ Init_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, const ResId& rResId ) :
+
+ SvTreeListBox( pParent, rResId )
+
+{
+ Init_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::SvxCheckListBox( Window* pParent, const ResId& rResId,
+ const Image& rNormalStaticImage,
+ const Image& /*TODO#i72485# rHighContrastStaticImage*/ ) :
+
+ SvTreeListBox( pParent, rResId )
+
+{
+ Init_Impl();
+ pCheckButton->aBmps[SV_BMP_STATICIMAGE] = rNormalStaticImage;
+}
+
+// -----------------------------------------------------------------------
+
+SvxCheckListBox::~SvxCheckListBox()
+{
+ delete pCheckButton;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::Init_Impl()
+{
+ pCheckButton = new SvLBoxButtonData( this );
+ EnableCheckButton( pCheckButton );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::InsertEntry( const String& rStr, sal_uInt16 nPos,
+ void* pUserData,
+ SvLBoxButtonKind eButtonKind )
+{
+ SvTreeListBox::InsertEntry( rStr, NULL, sal_False, nPos, pUserData,
+ eButtonKind );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::RemoveEntry( sal_uInt16 nPos )
+{
+ if ( nPos < GetEntryCount() )
+ SvTreeListBox::GetModel()->Remove( GetEntry( nPos ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect )
+{
+ if ( nPos < GetEntryCount() )
+ Select( GetEntry( nPos ), bSelect );
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxCheckListBox::GetSelectEntryPos() const
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+
+ if ( pEntry )
+ return (sal_uInt16)GetModel()->GetAbsPos( pEntry );
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+String SvxCheckListBox::GetText( sal_uInt16 nPos ) const
+{
+ SvLBoxEntry* pEntry = GetEntry( nPos );
+
+ if ( pEntry )
+ return GetEntryText( pEntry );
+ return String();
+}
+
+// -----------------------------------------------------------------------
+
+sal_uInt16 SvxCheckListBox::GetCheckedEntryCount() const
+{
+ sal_uInt16 nCheckCount = 0;
+ sal_uInt16 nCount = (sal_uInt16)GetEntryCount();
+
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ if ( IsChecked( i ) )
+ nCheckCount++;
+ }
+ return nCheckCount;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::CheckEntryPos( sal_uInt16 nPos, sal_Bool bCheck )
+{
+ if ( nPos < GetEntryCount() )
+ SetCheckButtonState(
+ GetEntry( nPos ), bCheck ? SvButtonState( SV_BUTTON_CHECKED ) :
+ SvButtonState( SV_BUTTON_UNCHECKED ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxCheckListBox::IsChecked( sal_uInt16 nPos ) const
+{
+ if ( nPos < GetEntryCount() )
+ return (GetCheckButtonState( GetEntry( nPos ) ) == SV_BUTTON_CHECKED);
+ else
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void* SvxCheckListBox::SetEntryData ( sal_uInt16 nPos, void* pNewData )
+{
+ void* pOld = NULL;
+
+ if ( nPos < GetEntryCount() )
+ {
+ pOld = GetEntry( nPos )->GetUserData();
+ GetEntry( nPos )->SetUserData( pNewData );
+ }
+ return pOld;
+}
+
+// -----------------------------------------------------------------------
+
+void* SvxCheckListBox::GetEntryData( sal_uInt16 nPos ) const
+{
+ if ( nPos < GetEntryCount() )
+ return GetEntry( nPos )->GetUserData();
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::ToggleCheckButton( SvLBoxEntry* pEntry )
+{
+ if ( pEntry )
+ {
+ if ( !IsSelected( pEntry ) )
+ Select( pEntry );
+ else
+ CheckEntryPos( GetSelectEntryPos(), !IsChecked( GetSelectEntryPos() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ const Point aPnt = rMEvt.GetPosPixel();
+ SvLBoxEntry* pEntry = GetEntry( aPnt );
+
+ if ( pEntry )
+ {
+ sal_Bool bCheck = ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED );
+ SvLBoxItem* pItem = GetItem( pEntry, aPnt.X() );
+
+ if ( pItem && pItem->IsA() == SV_ITEM_ID_LBOXBUTTON )
+ {
+ SvTreeListBox::MouseButtonDown( rMEvt );
+ Select( pEntry, sal_True );
+ return;
+ }
+ else
+ {
+ ToggleCheckButton( pEntry );
+ SvTreeListBox::MouseButtonDown( rMEvt );
+
+ // check if the entry below the mouse changed during the base method call. This is possible if,
+ // for instance, a handler invoked by the base class tampers with the list entries.
+ const SvLBoxEntry* pNewEntry = GetEntry( aPnt );
+ if ( pNewEntry != pEntry )
+ return;
+
+ if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) )
+ CheckButtonHdl();
+ return;
+ }
+ }
+ }
+ SvTreeListBox::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxCheckListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKey = rKEvt.GetKeyCode();
+
+ if ( rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_SPACE )
+ {
+ SvLBoxEntry* pEntry = GetCurEntry();
+
+ if ( pEntry )
+ {
+ sal_Bool bCheck = ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED );
+ ToggleCheckButton( pEntry );
+ if ( bCheck != ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED ) )
+ CheckButtonHdl();
+ }
+ }
+ else if ( GetEntryCount() )
+ SvTreeListBox::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+SvLBoxEntry* SvxCheckListBox::InsertEntry( const XubString& rText, SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uIntPtr nPos, void* pUserData, SvLBoxButtonKind eButtonKind )
+{
+ return SvTreeListBox::InsertEntry( rText, pParent, bChildsOnDemand, nPos, pUserData, eButtonKind );
+}
+
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
new file mode 100644
index 000000000000..81091d7d7e98
--- /dev/null
+++ b/svx/source/dialog/connctrl.cxx
@@ -0,0 +1,387 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svdoedge.hxx>
+#include <svx/svdattrx.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+
+#include <svx/svdpage.hxx> // SdrObjList
+
+#include "svx/connctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+// #110094#
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+
+// #110094#
+#include <svx/sdr/contact/displayinfo.hxx>
+#include <vcl/svapp.hxx>
+
+/*************************************************************************
+|*
+|* Ctor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+SvxXConnectionPreview::SvxXConnectionPreview( Window* pParent, const ResId& rResId,
+ const SfxItemSet& rInAttrs ) :
+ Control ( pParent, rResId ),
+ rAttrs ( rInAttrs ),
+ pEdgeObj( NULL ),
+ pObjList( NULL ),
+ pView ( NULL )
+{
+ SetMapMode( MAP_100TH_MM );
+ SetStyles();
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+SvxXConnectionPreview::~SvxXConnectionPreview()
+{
+ delete pObjList;
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXConnectionPreview
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::Construct()
+{
+ DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ sal_uIntPtr nMarkCount = rMarkList.GetMarkCount();
+
+ if( nMarkCount >= 1 )
+ {
+ sal_Bool bFound = sal_False;
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+
+ for( sal_uInt16 i = 0; i < nMarkCount && !bFound; i++ )
+ {
+ pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
+ sal_uInt32 nInv = pObj->GetObjInventor();
+ sal_uInt16 nId = pObj->GetObjIdentifier();
+ if( nInv == SdrInventor && nId == OBJ_EDGE )
+ {
+ bFound = sal_True;
+ SdrEdgeObj* pTmpEdgeObj = (SdrEdgeObj*) pObj;
+ pEdgeObj = (SdrEdgeObj*) pTmpEdgeObj->Clone();
+
+ SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_True );
+ SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_False );
+
+ rConn1 = pTmpEdgeObj->GetConnection( sal_True );
+ rConn2 = pTmpEdgeObj->GetConnection( sal_False );
+
+ SdrObject* pTmpObj1 = pTmpEdgeObj->GetConnectedNode( sal_True );
+ SdrObject* pTmpObj2 = pTmpEdgeObj->GetConnectedNode( sal_False );
+
+ // #110094#
+ // potential memory leak here (!). Create SdrObjList only when there is
+ // not yet one.
+ if(!pObjList)
+ {
+ pObjList = new SdrObjList( pView->GetModel(), NULL );
+ }
+
+ if( pTmpObj1 )
+ {
+ SdrObject* pObj1 = pTmpObj1->Clone();
+ pObjList->InsertObject( pObj1 );
+ pEdgeObj->ConnectToNode( sal_True, pObj1 );
+ }
+ if( pTmpObj2 )
+ {
+ SdrObject* pObj2 = pTmpObj2->Clone();
+ pObjList->InsertObject( pObj2 );
+ pEdgeObj->ConnectToNode( sal_False, pObj2 );
+ }
+ pObjList->InsertObject( pEdgeObj );
+ }
+ }
+ }
+
+ if( !pEdgeObj )
+ pEdgeObj = new SdrEdgeObj();
+
+ // Groesse anpassen
+ if( pObjList )
+ {
+ OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
+ Rectangle aRect = pObjList->GetAllObjBoundRect();
+
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() );
+ SetMapMode( aMapMode );
+
+ MapMode aDisplayMap( aMapMode );
+ Point aNewPos;
+ Size aNewSize;
+ const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
+ const long nWidth = aWinSize.Width();
+ const long nHeight = aWinSize.Height();
+ double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight();
+ double fWinWH = (double) nWidth / nHeight;
+
+ // Bitmap an Thumbgroesse anpassen (hier nicht!)
+ if ( fRectWH < fWinWH)
+ {
+ aNewSize.Width() = (long) ( (double) nHeight * fRectWH );
+ aNewSize.Height()= nHeight;
+ }
+ else
+ {
+ aNewSize.Width() = nWidth;
+ aNewSize.Height()= (long) ( (double) nWidth / fRectWH );
+ }
+
+ Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() );
+ Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() );
+ Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+
+ // MapMode umsetzen
+ aDisplayMap.SetScaleX( aMinFrac );
+ aDisplayMap.SetScaleY( aMinFrac );
+
+ // Zentrierung
+ aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
+ aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
+
+ aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) );
+ SetMapMode( aDisplayMap );
+
+ // Ursprung
+ aNewPos = aDisplayMap.GetOrigin();
+ aNewPos -= Point( aRect.TopLeft().X(), aRect.TopLeft().Y() );
+ aDisplayMap.SetOrigin( aNewPos );
+ SetMapMode( aDisplayMap );
+
+
+ Point aPos;
+ MouseEvent aMEvt( aPos, 1, 0, MOUSE_RIGHT );
+ MouseButtonDown( aMEvt );
+ /*
+ Point aPt( -aRect.TopLeft().X(), -aRect.TopLeft().Y() );
+ aMapMode.SetOrigin( aPt );
+
+ // Skalierung
+ Size aSize = GetOutputSize();
+ Fraction aFrac1( aSize.Width(), aRect.GetWidth() );
+ Fraction aFrac2( aSize.Height(), aRect.GetHeight() );
+ Fraction aMaxFrac( aFrac1 > aFrac2 ? aFrac1 : aFrac2 );
+ Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+ sal_Bool bChange = (sal_Bool) ( (double)aMinFrac > 1.0 );
+ aMapMode.SetScaleX( aMinFrac );
+ aMapMode.SetScaleY( aMinFrac );
+
+ // zentrieren
+ long nXXL = aSize.Width() > aRect.GetWidth() ? aSize.Width() : aRect.GetWidth();
+ long nXS = aSize.Width() <= aRect.GetWidth() ? aSize.Width() : aRect.GetWidth();
+ if( bChange )
+ {
+ long nTmp = nXXL; nXXL = nXS; nXS = nTmp;
+ }
+ long nX = (long) ( (double)aMinFrac * (double)nXXL );
+ nX = (long) ( (double)labs( nXS - nX ) / (double)aMinFrac / 2.0 );
+
+ long nYXL = aSize.Height() > aRect.GetHeight() ? aSize.Height() : aRect.GetHeight();
+ long nYS = aSize.Height() <= aRect.GetHeight() ? aSize.Height() : aRect.GetHeight();
+ if( bChange )
+ {
+ long nTmp = nXXL; nXXL = nXS; nXS = nTmp;
+ }
+ long nY = (long) ( (double)aMinFrac * (double)nYXL );
+ nY = (long) ( (double)labs( nYS - nY ) / (double)aMinFrac / 2.0 );
+
+ aPt += Point( nX, nY );
+ aMapMode.SetOrigin( aPt );
+
+ SetMapMode( aMapMode );
+ */
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: Paint()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::Paint( const Rectangle& )
+{
+ if( pObjList )
+ {
+ // #110094#
+ // This will not work anymore. To not start at Adam and Eve, i will
+ // ATM not try to change all this stuff to really using an own model
+ // and a view. I will just try to provide a mechanism to paint such
+ // objects without own model and without a page/view with the new
+ // mechanism.
+
+ // New stuff: Use a ObjectContactOfObjListPainter.
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ for(sal_uInt32 a(0L); a < pObjList->GetObjCount(); a++)
+ {
+ SdrObject* pObject = pObjList->GetObj(a);
+ DBG_ASSERT(pObject,
+ "SvxXConnectionPreview::Paint: Corrupt ObjectList (!)");
+ aObjectVector.push_back(pObject);
+ }
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs )
+{
+ //pEdgeObj->SetItemSetAndBroadcast(rInAttrs);
+ pEdgeObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Ermittelt die Anzahl der Linienversaetze anhand des Preview-Objektes
+|*
+*************************************************************************/
+
+sal_uInt16 SvxXConnectionPreview::GetLineDeltaAnz()
+{
+ const SfxItemSet& rSet = pEdgeObj->GetMergedItemSet();
+ sal_uInt16 nCount(0);
+
+ if(SFX_ITEM_DONTCARE != rSet.GetItemState(SDRATTR_EDGELINEDELTAANZ))
+ nCount = ((const SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue();
+
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvxXConnectionPreview: MouseButtonDown()
+|*
+*************************************************************************/
+
+void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ sal_Bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
+ sal_Bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
+ sal_Bool bCtrl = rMEvt.IsMod1();
+
+ if( bZoomIn || bZoomOut )
+ {
+ MapMode aMapMode = GetMapMode();
+ Fraction aXFrac = aMapMode.GetScaleX();
+ Fraction aYFrac = aMapMode.GetScaleY();
+ Fraction* pMultFrac;
+
+ if( bZoomIn )
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 3, 2 );
+ else
+ pMultFrac = new Fraction( 11, 10 );
+ }
+ else
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 2, 3 );
+ else
+ pMultFrac = new Fraction( 10, 11 );
+ }
+
+ aXFrac *= *pMultFrac;
+ aYFrac *= *pMultFrac;
+ if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
+ (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ {
+ aMapMode.SetScaleX( aXFrac );
+ aMapMode.SetScaleY( aYFrac );
+ SetMapMode( aMapMode );
+
+ Size aOutSize( GetOutputSize() );
+
+ Point aPt( aMapMode.GetOrigin() );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ aPt.X() += nX;
+ aPt.Y() += nY;
+
+ aMapMode.SetOrigin( aPt );
+ SetMapMode( aMapMode );
+
+ Invalidate();
+ }
+ delete pMultFrac;
+ }
+}
+
+void SvxXConnectionPreview::SetStyles()
+{
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) );
+}
+
+void SvxXConnectionPreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetStyles();
+ }
+}
+
diff --git a/svx/source/dialog/contdlg.hrc b/svx/source/dialog/contdlg.hrc
new file mode 100644
index 000000000000..a191231daa22
--- /dev/null
+++ b/svx/source/dialog/contdlg.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+
+// ImapDlg-Dialoge
+#define RID_SVX_CONTOURDLG_START RID_SVX_CONTOUR_START
+
+
+/******************************************************************************/
+
+
+#define RID_SVXDLG_CONTOUR (RID_SVX_CONTOURDLG_START)
+
+#define TBX1 1
+#define TBI_APPLY 1
+
+#define TBI_WORKPLACE 2
+
+#define TBI_SELECT 5
+#define TBI_RECT 6
+#define TBI_CIRCLE 7
+#define TBI_POLY 8
+#define TBI_FREEPOLY 9
+
+#define TBI_POLYEDIT 15
+#define TBI_POLYMOVE 16
+#define TBI_POLYINSERT 17
+#define TBI_POLYDELETE 18
+
+#define TBI_UNDO 20
+#define TBI_REDO 21
+
+#define TBI_AUTOCONTOUR 25
+#define TBI_PIPETTE 26
+
+#define MTF_TOLERANCE 1
+
+#define CTL_CONTOUR 1
+
+#define STB_STATUS 1
+
+#define CD_IMAPDLG 1300
+#define CDH_IMAPDLG 1301
+
+
+/******************************************************************************/
+
+#define STR_CONTOURDLG_MODIFY (RID_SVX_CONTOURDLG_START + 2)
+#define STR_CONTOURDLG_NEWPIPETTE (RID_SVX_CONTOURDLG_START + 3)
+#define STR_CONTOURDLG_WORKPLACE (RID_SVX_CONTOURDLG_START + 4)
+#define STR_CONTOURDLG_LINKED (RID_SVX_CONTOURDLG_START + 5)
+
+/******************************************************************************/
+
+
+/******************************************************************************/
+
+
+/******************************************************************************/
+
+
+/******************************************************************************/
diff --git a/svx/source/dialog/contdlg.src b/svx/source/dialog/contdlg.src
new file mode 100644
index 000000000000..989bdd93d336
--- /dev/null
+++ b/svx/source/dialog/contdlg.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include "contdlg.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+ // RID_SVXDLG_CONTOUR ----------------------------------------------------
+FloatingWindow RID_SVXDLG_CONTOUR
+{
+ HelpID = "svx:FloatingWindow:RID_SVXDLG_CONTOUR";
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 270 , 213 ) ;
+ Text [ en-US ] = "Contour Editor" ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ ToolBox TBX1
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ HelpId = HID_CONTDLG_TOOLBOX ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_APPLY ;
+ HelpId = HID_CONTDLG_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_WORKPLACE ;
+ HelpId = HID_CONTDLG_WORKPLACE ;
+ Text [ en-US ] = "Workspace" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SELECT ;
+ HelpId = HID_CONTDLG_SELECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Select" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_RECT ;
+ HelpId = HID_CONTDLG_RECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Rectangle" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_CIRCLE ;
+ HelpId = HID_CONTDLG_CIRCLE ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Ellipse" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLY ;
+ HelpId = HID_CONTDLG_POLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Polygon" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYEDIT ;
+ HelpId = HID_CONTDLG_POLYEDIT ;
+ Text [ en-US ] = "Edit Points" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYMOVE ;
+ HelpId = HID_CONTDLG_POLYMOVE ;
+ Text [ en-US ] = "Move Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYINSERT ;
+ HelpId = HID_CONTDLG_POLYINSERT ;
+ Text [ en-US ] = "Insert Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYDELETE ;
+ HelpId = HID_CONTDLG_POLYDELETE ;
+ Text [ en-US ] = "Delete Points" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_AUTOCONTOUR ;
+ HelpId = HID_CONTDLG_AUTOCONTOUR ;
+ Text [ en-US ] = "AutoContour" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_UNDO ;
+ HelpId = HID_CONTDLG_UNDO ;
+
+ Text [ en-US ] = "Undo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_REDO ;
+ HelpId = HID_CONTDLG_REDO ;
+
+
+ Text [ en-US ] = "Redo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_PIPETTE ;
+ HelpId = HID_CONTDLG_PIPETTE ;
+ Text [ en-US ] = "Pipette" ;
+ AutoCheck = TRUE ;
+ };
+ };
+ };
+ MetricField MTF_TOLERANCE
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_CONTOUR:MTF_TOLERANCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 99 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ Unit = FUNIT_CUSTOM ;
+ QuickHelpText [ en-US ] = "Color Tolerance" ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+ Control CTL_CONTOUR
+ {
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ HelpId = HID_CONTDLG_GRAPHWND ;
+ };
+
+#define CONTOURDLG_IDLIST \
+ IdList = \
+ { \
+ TBI_APPLY ; \
+ TBI_WORKPLACE ; \
+ TBI_SELECT ; \
+ TBI_RECT ; \
+ TBI_CIRCLE ; \
+ TBI_POLY ; \
+ TBI_POLYEDIT ; \
+ TBI_POLYMOVE ; \
+ TBI_POLYINSERT ; \
+ TBI_POLYDELETE ; \
+ TBI_AUTOCONTOUR ; \
+ TBI_UNDO ; \
+ TBI_REDO ; \
+ TBI_PIPETTE ; \
+ }; \
+ IdCount = { 14 ; };
+
+ ImageList CD_IMAPDLG
+ {
+ Prefix = "cd";
+ MASKCOLOR
+ CONTOURDLG_IDLIST
+ };
+ ImageList CDH_IMAPDLG
+ {
+ Prefix = "cdh";
+ MASKCOLOR
+ CONTOURDLG_IDLIST
+ };
+};
+/******************************************************************************/
+String STR_CONTOURDLG_MODIFY
+{
+ Text [ en-US ] = "The contour has been modified.\nDo you want to save the changes?" ;
+};
+String STR_CONTOURDLG_NEWPIPETTE
+{
+ Text [ en-US ] = "Do you want to create a new contour?" ;
+};
+String STR_CONTOURDLG_WORKPLACE
+{
+ Text [ en-US ] = "Setting a new workspace will\ncause the contour to be deleted.\nAre you sure you want to continue?" ;
+};
+String STR_CONTOURDLG_LINKED
+{
+ Text [ en-US ] = "This graphic object is linked to the document. Do you want to unlink the graphics in order to edit it?" ;
+};
+/******************************************************************************/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/contimp.hxx b/svx/source/dialog/contimp.hxx
new file mode 100644
index 000000000000..4993d15839e4
--- /dev/null
+++ b/svx/source/dialog/contimp.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONTIMP_HXX_
+#define _CONTIMP_HXX_
+
+#ifndef _CONTDLG_HXX
+#include <svx/contdlg.hxx>
+#endif
+#include "contwnd.hxx"
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+
+#define CONT_RESID(nId) ResId( nId, DIALOG_MGR() )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class SvxSuperContourDlg : public SvxContourDlg
+{
+ using SvxContourDlg::GetPolyPolygon;
+
+ Graphic aGraphic;
+ Graphic aUndoGraphic;
+ Graphic aRedoGraphic;
+ Graphic aUpdateGraphic;
+ PolyPolygon aUpdatePolyPoly;
+ Timer aUpdateTimer;
+ Timer aCreateTimer;
+ Size aLastSize;
+ void* pUpdateEditingObject;
+ void* pCheckObj;
+ SvxContourDlgItem aContourItem;
+ ToolBox aTbx1;
+ MetricField aMtfTolerance;
+ ContourWindow aContourWnd;
+ StatusBar aStbStatus;
+ sal_uIntPtr nGrfChanged;
+ sal_Bool bExecState;
+ sal_Bool bPipetteMode;
+ sal_Bool bWorkplaceMode;
+ sal_Bool bUpdateGraphicLinked;
+ sal_Bool bGraphicLinked;
+ ImageList maImageList;
+ ImageList maImageListH;
+
+ virtual void Resize();
+ virtual sal_Bool Close();
+
+ void DoAutoCreate();
+ void ReducePoints( const long nTol = 8 );
+
+ DECL_LINK( Tbx1ClickHdl, ToolBox* );
+ DECL_LINK( MousePosHdl, ContourWindow* );
+ DECL_LINK( GraphSizeHdl, ContourWindow* );
+ DECL_LINK( UpdateHdl, Timer* );
+ DECL_LINK( CreateHdl, Timer* );
+ DECL_LINK( StateHdl, ContourWindow* );
+ DECL_LINK( PipetteHdl, ContourWindow* );
+ DECL_LINK( PipetteClickHdl, ContourWindow* );
+ DECL_LINK( WorkplaceClickHdl, ContourWindow* );
+ DECL_LINK( MiscHdl, void* );
+
+public:
+
+ SvxSuperContourDlg( SfxBindings *pBindings, SfxChildWindow *pCW,
+ Window* pParent, const ResId& rResId );
+ ~SvxSuperContourDlg();
+
+ void SetExecState( sal_Bool bEnable );
+
+ void SetGraphic( const Graphic& rGraphic );
+ void SetGraphicLinked( sal_Bool bLinked ) { bGraphicLinked = bLinked; }
+ const Graphic& GetGraphic() const { return aGraphic; }
+ sal_Bool IsGraphicChanged() const { return nGrfChanged > 0UL; }
+
+ void SetPolyPolygon( const PolyPolygon& rPolyPoly );
+ PolyPolygon GetPolyPolygon( sal_Bool bRescaleToGraphic = sal_True );
+
+ void SetEditingObject( void* pObj ) { pCheckObj = pObj; }
+ const void* GetEditingObject() const { return pCheckObj; }
+
+ sal_Bool IsUndoPossible() const;
+ sal_Bool IsRedoPossible() const;
+
+ void UpdateGraphic( const Graphic& rGraphic, sal_Bool bGraphicLinked,
+ const PolyPolygon* pPolyPoly = NULL,
+ void* pEditingObj = NULL );
+
+ /** switches the toolbox images depending on the actuall high contrast display mode state */
+ void ApplyImageList();
+
+ /** virtual method from Window is used to detect change in high contrast display mode
+ to switch the toolbox images */
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+};
+
+
+#endif // _CONTIMP_HXX_
+
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
new file mode 100644
index 000000000000..a7f98ea124de
--- /dev/null
+++ b/svx/source/dialog/contwnd.cxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/xoutbmp.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <contdlg.hrc>
+#include <contwnd.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/xfillit.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+
+// #i75482#
+#include "svx/sdrpaintwindow.hxx"
+
+#define TRANSCOL Color( COL_WHITE )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+ContourWindow::ContourWindow( Window* pParent, const ResId& rResId ) :
+ GraphCtrl ( pParent, rResId ),
+ aWorkRect ( 0, 0, 0, 0 ),
+ bPipetteMode ( sal_False ),
+ bWorkplaceMode ( sal_False ),
+ bClickValid ( sal_False )
+{
+ SetWinStyle( WB_SDRMODE );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+ContourWindow::~ContourWindow()
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::SetPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ const sal_uInt16 nPolyCount = rPolyPoly.Count();
+
+ // zuerst alle Zeichenobjekte loeschen
+ aPolyPoly = rPolyPoly;
+
+ // #117412#
+ // To avoid to have destroyed objects which are still selected, it is necessary to deselect
+ // them first (!)
+ pView->UnmarkAllObj();
+
+ pPage->Clear();
+
+ for ( sal_uInt16 i = 0; i < nPolyCount; i++ )
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
+ SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon );
+
+ if ( pPathObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+
+ //pPathObj->SetItemSetAndBroadcast(aSet);
+ pPathObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pPage->InsertObject( pPathObj );
+ }
+ }
+
+ if ( nPolyCount )
+ {
+ pView->MarkAll();
+ pView->CombineMarkedObjects( sal_False );
+ }
+
+ pModel->SetChanged( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const PolyPolygon& ContourWindow::GetPolyPolygon()
+{
+ if ( pModel->IsChanged() )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+
+ aPolyPoly = PolyPolygon();
+
+ if ( pPage && pPage->GetObjCount() )
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*)pPage->GetObj(0L);
+ // Not sure if subdivision is needed for ContourWindow, but maybe it cannot handle
+ // curves at all. Keeping subdivision here for security
+ const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::adaptiveSubdivideByAngle(pPathObj->GetPathPoly()));
+ aPolyPoly = PolyPolygon(aB2DPolyPolygon);
+ }
+
+ pModel->SetChanged( sal_False );
+ }
+
+ return aPolyPoly;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::InitSdrModel()
+{
+ GraphCtrl::InitSdrModel();
+
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ pView->SetAttributes( aSet );
+ pView->SetFrameDragSingles( sal_True );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::SdrObjCreated( const SdrObject& )
+{
+ pView->MarkAll();
+ pView->CombineMarkedObjects( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool ContourWindow::IsContourChanged() const
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_Bool bRet = sal_False;
+
+ if ( pPage && pPage->GetObjCount() )
+ bRet = ( (SdrPathObj*) pPage->GetObj( 0 ) )->GetPathPoly().count() && pModel->IsChanged();
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( bWorkplaceMode )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ SetPolyPolygon( PolyPolygon() );
+ aWorkRect = Rectangle( aLogPt, aLogPt );
+ Paint( Rectangle( Point(), GetGraphicSize() ) );
+ SetEditMode( sal_True );
+ }
+
+ if ( !bPipetteMode )
+ GraphCtrl::MouseButtonDown( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ bClickValid = sal_False;
+
+ if ( bPipetteMode )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ aPipetteColor = GetPixel( aLogPt );
+ Control::MouseMove( rMEvt );
+
+ if ( aPipetteLink.IsSet() && Rectangle( Point(), GetGraphicSize() ).IsInside( aLogPt ) )
+ {
+ SetPointer( POINTER_REFHAND );
+ aPipetteLink.Call( this );
+ }
+ }
+ else
+ GraphCtrl::MouseMove( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ Point aTmpPoint;
+ const Rectangle aGraphRect( aTmpPoint, GetGraphicSize() );
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ bClickValid = aGraphRect.IsInside( aLogPt );
+ ReleaseMouse();
+
+ if ( bPipetteMode )
+ {
+ Control::MouseButtonUp( rMEvt );
+
+ if ( aPipetteClickLink.IsSet() )
+ aPipetteClickLink.Call( this );
+ }
+ else if ( bWorkplaceMode )
+ {
+ GraphCtrl::MouseButtonUp( rMEvt );
+
+ aWorkRect.Right() = aLogPt.X();
+ aWorkRect.Bottom() = aLogPt.Y();
+ aWorkRect.Intersection( aGraphRect );
+ aWorkRect.Justify();
+
+ if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() )
+ {
+ PolyPolygon _aPolyPoly( GetPolyPolygon() );
+
+ _aPolyPoly.Clip( aWorkRect );
+ SetPolyPolygon( _aPolyPoly );
+ pView->SetWorkArea( aWorkRect );
+ }
+ else
+ pView->SetWorkArea( aGraphRect );
+
+ Invalidate( aGraphRect );
+
+ if ( aWorkplaceClickLink.IsSet() )
+ aWorkplaceClickLink.Call( this );
+ }
+ else
+ GraphCtrl::MouseButtonUp( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void ContourWindow::Paint( const Rectangle& rRect )
+{
+ // #i75482#
+ // encapsulate the redraw using Begin/End and use the returned
+ // data to get the target output device (e.g. when pre-rendering)
+ SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(this);
+ OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
+
+ const Graphic& rGraphic = GetGraphic();
+ const Color& rOldLineColor = GetLineColor();
+ const Color& rOldFillColor = GetFillColor();
+
+ rTarget.SetLineColor( Color( COL_BLACK ) );
+ rTarget.SetFillColor( Color( COL_WHITE ) );
+
+ rTarget.DrawRect( Rectangle( Point(), GetGraphicSize() ) );
+
+ rTarget.SetLineColor( rOldLineColor );
+ rTarget.SetFillColor( rOldFillColor );
+
+ if ( rGraphic.GetType() != GRAPHIC_NONE )
+ rGraphic.Draw( &rTarget, Point(), GetGraphicSize() );
+
+ if ( aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom() )
+ {
+ PolyPolygon _aPolyPoly( 2, 2 );
+ const Color aOldFillColor( GetFillColor() );
+
+ _aPolyPoly.Insert( Rectangle( Point(), GetGraphicSize() ) );
+ _aPolyPoly.Insert( aWorkRect );
+
+ rTarget.SetFillColor( COL_LIGHTRED );
+ rTarget.DrawTransparent( _aPolyPoly, 50 );
+ rTarget.SetFillColor( aOldFillColor );
+ }
+
+ // #i75482#
+ const Region aRepaintRegion(rRect);
+ pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
+ pView->EndCompleteRedraw(*pPaintWindow, true);
+}
+
+// eof
diff --git a/svx/source/dialog/contwnd.hxx b/svx/source/dialog/contwnd.hxx
new file mode 100644
index 000000000000..94addbe0b51f
--- /dev/null
+++ b/svx/source/dialog/contwnd.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CONTWND_HXX
+#define _CONTWND_HXX
+
+#include <tools/poly.hxx>
+#include <svx/graphctl.hxx>
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class ContourWindow : public GraphCtrl
+{
+ PolyPolygon aPolyPoly;
+ Color aPipetteColor;
+ Rectangle aWorkRect;
+ Link aPipetteLink;
+ Link aPipetteClickLink;
+ Link aWorkplaceClickLink;
+ sal_Bool bPipetteMode;
+ sal_Bool bWorkplaceMode;
+ sal_Bool bClickValid;
+
+protected:
+
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void InitSdrModel();
+ virtual void Paint( const Rectangle& rRect );
+
+ void CreatePolyPolygon();
+
+public:
+
+ ContourWindow( Window* pParent, const ResId& rResId );
+ ~ContourWindow();
+
+ void SetPolyPolygon( const PolyPolygon& rPolyPoly );
+ const PolyPolygon& GetPolyPolygon();
+
+ void SetPipetteMode( const sal_Bool bPipette ) { bPipetteMode = bPipette; }
+ sal_Bool IsPipetteMode() const { return bPipetteMode; }
+ const Color& GetPipetteColor() const { return aPipetteColor; }
+
+ sal_Bool IsClickValid() const { return bClickValid; }
+ sal_Bool IsContourChanged() const;
+
+ void SetWorkplaceMode( const sal_Bool bWorkplace ) { bWorkplaceMode = bWorkplace; }
+ sal_Bool IsWorkplaceMode() const { return bWorkplaceMode; }
+ const Rectangle& GetWorkRect() const { return aWorkRect; }
+
+ void SetPipetteHdl( const Link& rLink ) { aPipetteLink = rLink; }
+ void SetPipetteClickHdl( const Link& rLink ) { aPipetteClickLink = rLink; }
+
+ void SetWorkplaceClickHdl( const Link& rLink ) { aWorkplaceClickLink = rLink; }
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx
new file mode 100644
index 000000000000..c3f1f0b17a52
--- /dev/null
+++ b/svx/source/dialog/ctredlin.cxx
@@ -0,0 +1,1531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// System - Includes ---------------------------------------------------------
+#include <vcl/svapp.hxx>
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <svtools/txtcmp.hxx>
+#include <unotools/charclass.hxx>
+// INCLUDE -------------------------------------------------------------------
+#include <editeng/unolingu.hxx>
+#include <svx/dialmgr.hxx>
+#include "ctredlin.hrc"
+#include <svx/ctredlin.hxx>
+#include "helpid.hrc"
+
+//============================================================================
+// Local Defines and Function
+//----------------------------------------------------------------------------
+
+inline void EnableDisable( Window& rWin, sal_Bool bEnable )
+{
+ if (bEnable)
+ rWin.Enable();
+ else
+ rWin.Disable();
+}
+
+static long nStaticTabs[]=
+{
+ 5,10,65,120,170,220
+};
+
+#define MIN_DISTANCE 6
+#define WRITER_AUTHOR 1
+#define WRITER_DATE 2
+#define CALC_AUTHOR 2
+#define CALC_DATE 3
+
+RedlinData::RedlinData()
+{
+ bDisabled=sal_False;
+ pData=NULL;
+}
+RedlinData::~RedlinData()
+{
+}
+
+//============================================================================
+// class SvxRedlinEntry (Eintraege fuer Liste)
+//----------------------------------------------------------------------------
+
+SvxRedlinEntry::SvxRedlinEntry()
+ :SvLBoxEntry()
+{
+}
+
+SvxRedlinEntry::~SvxRedlinEntry()
+{
+ RedlinData* pRedDat=(RedlinData*) GetUserData();
+ if(pRedDat!=NULL)
+ {
+ delete pRedDat;
+ }
+}
+
+/*************************************************************************
+#* Funktionen der in den SvxRedlinTable eingefuegten Items
+#************************************************************************/
+
+DBG_NAME(SvLBoxColorString);
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Konstruktor der Klasse SvLBoxColorString
+#*
+#* Input: Box- Entry,Flags, Text fuer Anzeige, Schrift
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::SvLBoxColorString( SvLBoxEntry*pEntry,sal_uInt16 nFlags,const XubString& rStr,
+ const Color& rCol)
+
+: SvLBoxString( pEntry, nFlags, rStr )
+{
+ DBG_CTOR(SvLBoxColorString,0);
+ aPrivColor=rCol;
+ SetText( pEntry, rStr );
+}
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Default Konstruktor der Klasse SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::SvLBoxColorString()
+: SvLBoxString()
+{
+ DBG_CTOR(SvLBoxColorString,0);
+}
+
+/*************************************************************************
+#* Member: ~SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Destruktor der Klasse SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+SvLBoxColorString::~SvLBoxColorString()
+{
+ DBG_DTOR(SvLBoxColorString,0);
+}
+
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Erzeugt einen neuen SvLBoxColorString
+#*
+#* Input: ---
+#*
+#* Output: SvLBoxColorString
+#*
+#************************************************************************/
+
+SvLBoxItem* SvLBoxColorString::Create() const
+{
+ DBG_CHKTHIS(SvLBoxColorString,0);
+ return new SvLBoxColorString;
+}
+
+
+
+/*************************************************************************
+#* Member: SvLBoxColorString Datum:23.10.97
+#*------------------------------------------------------------------------
+#*
+#* Klasse: SvLBoxColorString
+#*
+#* Funktion: Zeichenroutine des SvLBoxColorString. Gezeichnet wird
+#* der entsprechende Text mit der eingestellten Farbe
+#* im Ausgabe- Device.
+#*
+#* Input: Position, Ausgabe- Device, Flag fuer Selection,
+#* Zeiger auf den Eintrag
+#*
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvLBoxColorString::Paint( const Point& rPos, SvLBox& rDev,
+ sal_uInt16 nFlags, SvLBoxEntry* pEntry )
+{
+ Color aColor=rDev.GetTextColor();
+ Color a2Color=aColor;
+ if(!(nFlags & SVLISTENTRYFLAG_SELECTED))
+ {
+ rDev.SetTextColor(aPrivColor);
+ }
+ SvLBoxString::Paint(rPos,rDev,nFlags,pEntry );
+ rDev.SetTextColor(a2Color);
+}
+
+//============================================================================
+// class SvxRedlinTable
+//----------------------------------------------------------------------------
+
+SvxRedlinTable::SvxRedlinTable( Window* pParent,WinBits nBits ):
+ SvxSimpleTable(pParent,nBits )
+{
+ bAuthor=sal_False;
+ bDate=sal_False;
+ bIsCalc=sal_False;
+ bComment=sal_False;
+ nDatePos=WRITER_DATE;
+ pCommentSearcher=NULL;
+ SetNodeDefaultImages();
+}
+
+SvxRedlinTable::SvxRedlinTable( Window* pParent,const ResId& rResId):
+ SvxSimpleTable(pParent,rResId)
+{
+ bAuthor=sal_False;
+ bDate=sal_False;
+ bIsCalc=sal_False;
+ bComment=sal_False;
+ nDatePos=WRITER_DATE;
+ pCommentSearcher=NULL;
+ SetNodeDefaultImages();
+}
+
+SvxRedlinTable::~SvxRedlinTable()
+{
+ if(pCommentSearcher!=NULL)
+ delete pCommentSearcher;
+}
+
+StringCompare SvxRedlinTable::ColCompare(SvLBoxEntry* pLeft,SvLBoxEntry* pRight)
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ if(aColCompareLink.IsSet())
+ {
+ SvSortData aRedlinCompare;
+ aRedlinCompare.pLeft=pLeft;
+ aRedlinCompare.pRight=pRight;
+ eCompare=(StringCompare) aColCompareLink.Call(&aRedlinCompare);
+ }
+ else
+ {
+ if(nDatePos==GetSortedCol())
+ {
+ RedlinData *pLeftData=(RedlinData *)(pLeft->GetUserData());
+ RedlinData *pRightData=(RedlinData *)(pRight->GetUserData());
+
+ if(pLeftData!=NULL && pRightData!=NULL)
+ {
+ if(pLeftData->aDateTime < pRightData->aDateTime)
+ {
+ eCompare=COMPARE_LESS;
+ }
+ else if(pLeftData->aDateTime > pRightData->aDateTime)
+ {
+ eCompare=COMPARE_GREATER;
+ }
+ }
+ else
+ eCompare=SvxSimpleTable::ColCompare(pLeft,pRight);
+ }
+ else
+ {
+ eCompare=SvxSimpleTable::ColCompare(pLeft,pRight);
+ }
+
+ }
+
+ return eCompare;
+}
+void SvxRedlinTable::SetCalcView(sal_Bool bFlag)
+{
+ bIsCalc=bFlag;
+ if(bFlag)
+ {
+ nDatePos=CALC_DATE;
+ }
+ else
+ {
+ nDatePos=WRITER_DATE;
+ }
+}
+
+
+void SvxRedlinTable::UpdateFilterTest()
+{
+ Date aDateMax;
+ sal_uInt16 nYEAR=aDateMax.GetYear()+100;
+ aDateMax.SetYear(nYEAR);
+ Date aDateMin(1,1,1989);
+ Time aTMin(0);
+ Time aTMax(23,59,59);
+
+
+ DateTime aDTMin(aDateMin);
+ DateTime aDTMax(aDateMax);
+
+ switch(nDaTiMode)
+ {
+ case FLT_DATE_BEFORE:
+ aDaTiFilterFirst=aDTMin;
+ aDaTiFilterLast=aDaTiFirst;
+ break;
+ case FLT_DATE_SAVE:
+ case FLT_DATE_SINCE:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDTMax;
+ break;
+ case FLT_DATE_EQUAL:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiFirst;
+ aDaTiFilterFirst.SetTime(aTMin.GetTime());
+ aDaTiFilterLast.SetTime(aTMax.GetTime());
+ break;
+ case FLT_DATE_NOTEQUAL:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiFirst;
+ aDaTiFilterFirst.SetTime(aTMin.GetTime());
+ aDaTiFilterLast.SetTime(aTMax.GetTime());
+ break;
+ case FLT_DATE_BETWEEN:
+ aDaTiFilterFirst=aDaTiFirst;
+ aDaTiFilterLast=aDaTiLast;
+ break;
+ }
+}
+
+
+void SvxRedlinTable::SetFilterDate(sal_Bool bFlag)
+{
+ bDate=bFlag;
+}
+
+void SvxRedlinTable::SetDateTimeMode(sal_uInt16 nMode)
+{
+ nDaTiMode=nMode;
+}
+
+void SvxRedlinTable::SetFirstDate(const Date& aDate)
+{
+ aDaTiFirst.SetDate(aDate.GetDate());
+}
+
+void SvxRedlinTable::SetLastDate(const Date& aDate)
+{
+ aDaTiLast.SetDate(aDate.GetDate());
+}
+
+void SvxRedlinTable::SetFirstTime(const Time& aTime)
+{
+ aDaTiFirst.SetTime(aTime.GetTime());
+}
+
+void SvxRedlinTable::SetLastTime(const Time& aTime)
+{
+ aDaTiLast.SetTime(aTime.GetTime());
+}
+
+void SvxRedlinTable::SetFilterAuthor(sal_Bool bFlag)
+{
+ bAuthor=bFlag;
+}
+
+void SvxRedlinTable::SetAuthor(const String &aString)
+{
+ aAuthor=aString;
+}
+
+void SvxRedlinTable::SetFilterComment(sal_Bool bFlag)
+{
+ bComment=bFlag;
+}
+
+void SvxRedlinTable::SetCommentParams( const utl::SearchParam* pSearchPara )
+{
+ if(pSearchPara!=NULL)
+ {
+ if(pCommentSearcher!=NULL) delete pCommentSearcher;
+
+ pCommentSearcher=new utl::TextSearch(*pSearchPara, LANGUAGE_SYSTEM );
+ }
+}
+
+sal_Bool SvxRedlinTable::IsValidWriterEntry(const String& rString,RedlinData *pUserData)
+{
+ sal_Bool nTheFlag=sal_True;
+ String aString=rString.GetToken(WRITER_AUTHOR,'\t');
+ if(pUserData==NULL)
+ {
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(aString)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ }
+ else
+ {
+ DateTime aDateTime=pUserData->aDateTime;
+ nTheFlag=IsValidEntry(&aString,&aDateTime);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidCalcEntry(const String& rString,RedlinData *pUserData)
+{
+ sal_Bool nTheFlag=sal_True;
+ String aString=rString.GetToken(CALC_AUTHOR,'\t');
+ if(pUserData==NULL)
+ {
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(aString)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ }
+ else
+ {
+ DateTime aDateTime=pUserData->aDateTime;
+ nTheFlag=IsValidEntry(&aString,&aDateTime);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,
+ const DateTime *pDateTime,const String* pCommentStr)
+{
+ bool nTheFlag=true;
+ if(bAuthor)
+ {
+ nTheFlag = aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL;
+ }
+ if(bDate && nTheFlag)
+ {
+ if(nDaTiMode!=FLT_DATE_NOTEQUAL)
+ {
+ nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast);
+ }
+ else
+ {
+ nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast));
+ }
+ }
+ if(bComment && nTheFlag)
+ {
+ xub_StrLen nStartPos = 0;
+ xub_StrLen nEndPos = pCommentStr->Len();
+
+ nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidEntry(const String* pAuthorStr,const DateTime *pDateTime)
+{
+ sal_Bool nTheFlag=sal_True;
+ if(bAuthor)
+ {
+ if(aAuthor.CompareTo(*pAuthorStr)==COMPARE_EQUAL)
+ nTheFlag=sal_True;
+ else
+ nTheFlag=sal_False;
+ }
+ if(bDate && nTheFlag)
+ {
+ if(nDaTiMode!=FLT_DATE_NOTEQUAL)
+ {
+ nTheFlag=pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast);
+ }
+ else
+ {
+ nTheFlag=!(pDateTime->IsBetween(aDaTiFilterFirst,aDaTiFilterLast));
+ }
+ }
+ return nTheFlag;
+}
+
+sal_Bool SvxRedlinTable::IsValidComment(const String* pCommentStr)
+{
+ bool nTheFlag=true;
+
+ if(bComment)
+ {
+ xub_StrLen nStartPos = 0;
+ xub_StrLen nEndPos = pCommentStr->Len();
+
+ nTheFlag=pCommentSearcher->SearchFrwrd( *pCommentStr, &nStartPos, &nEndPos);
+ }
+ return nTheFlag;
+}
+
+SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData,
+ SvLBoxEntry* pParent,sal_uIntPtr nPos)
+{
+ aEntryColor=GetTextColor();
+ if(pUserData!=NULL)
+ {
+ if(pUserData->bDisabled)
+ aEntryColor=Color(COL_GRAY);
+ }
+
+ XubString aStr= rStr;
+
+ XubString aFirstStr( aStr );
+ xub_StrLen nEnd = aFirstStr.Search( sal_Unicode( '\t' ) );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData );
+
+}
+
+SvLBoxEntry* SvxRedlinTable::InsertEntry(const String& rStr,RedlinData *pUserData,const Color& aColor,
+ SvLBoxEntry* pParent,sal_uIntPtr nPos)
+{
+ aEntryColor=aColor;
+
+ XubString aStr= rStr;
+
+ XubString aFirstStr( aStr );
+ xub_StrLen nEnd = aFirstStr.Search( sal_Unicode ( '\t' ) );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, sal_False, nPos, pUserData );
+}
+
+SvLBoxEntry* SvxRedlinTable::CreateEntry() const
+{
+ return new SvxRedlinEntry;
+}
+
+void SvxRedlinTable::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
+ const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind )
+{
+ SvLBoxButton* pButton;
+ SvLBoxString* pString;
+ SvLBoxContextBmp* pContextBmp;
+
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ {
+ pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData );
+ pEntry->AddItem( pButton );
+ }
+
+ pContextBmp= new SvLBoxContextBmp( pEntry,0, rColl,rExp,
+ SVLISTENTRYFLAG_EXPANDED);
+ pEntry->AddItem( pContextBmp );
+
+ pString = new SvLBoxColorString( pEntry, 0, rStr ,aEntryColor);
+ pEntry->AddItem( pString );
+
+ XubString aToken;
+
+ xub_Unicode* pCurToken = (xub_Unicode*)aCurEntry.GetBuffer();
+ sal_uInt16 nCurTokenLen;
+ xub_Unicode* pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen );
+ sal_uInt16 nCount = TabCount(); nCount--;
+
+ for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
+ {
+ if( pCurToken && nCurTokenLen )
+ // aToken.Assign( pCurToken, nCurTokenLen );
+ aToken = XubString( pCurToken, nCurTokenLen );
+ else
+ aToken.Erase();
+
+ SvLBoxColorString* pStr = new SvLBoxColorString( pEntry, 0, aToken ,aEntryColor);
+ pEntry->AddItem( pStr );
+
+ pCurToken = pNextToken;
+ if( pCurToken )
+ pNextToken = (xub_Unicode*)GetToken( pCurToken, nCurTokenLen );
+ else
+ nCurTokenLen = 0;
+ }
+}
+
+
+
+
+//============================================================================
+// class SvxTPView
+//----------------------------------------------------------------------------
+
+SvxTPView::SvxTPView( Window * pParent)
+ : TabPage( pParent, SVX_RES(SID_REDLIN_VIEW_PAGE)),
+ aViewData ( this, SVX_RES( DG_VIEW) ),
+ PbAccept ( this, SVX_RES(PB_ACCEPT ) ),
+ PbReject ( this, SVX_RES(PB_REJECT ) ),
+ PbAcceptAll ( this, SVX_RES(PB_ACCEPTALL ) ),
+ PbRejectAll ( this, SVX_RES(PB_REJECTALL ) ),
+ PbUndo ( this, SVX_RES(PB_UNDO ) ),
+ aTitle1 ( SVX_RES( STR_TITLE1 ) ), // lokale Resource
+ aTitle2 ( SVX_RES( STR_TITLE2 ) ),
+ aTitle3 ( SVX_RES( STR_TITLE3 ) ),
+ aTitle4 ( SVX_RES( STR_TITLE4 ) ),
+ aTitle5 ( SVX_RES( STR_TITLE5 ) ),
+ aStrMyName ( SVX_RES( STR_VIEW) )
+{
+ FreeResource();
+
+ aViewData.SetHelpId(HID_REDLINING_VIEW_DG_VIEW_TABLE);
+ aViewData.SetHeaderBarHelpId(HID_REDLINING_VIEW_DG_VIEW_HEADER);
+
+ aMinSize=GetSizePixel();
+
+ Link aLink=LINK( this, SvxTPView, PbClickHdl);
+
+ PbAccept.SetClickHdl(aLink);
+ PbAcceptAll.SetClickHdl(aLink);
+ PbReject.SetClickHdl(aLink);
+ PbRejectAll.SetClickHdl(aLink);
+ PbUndo.SetClickHdl(aLink);
+
+ nDistance=PbAccept.GetSizePixel().Height()+2*MIN_DISTANCE;
+ aViewData.SetTabs(nStaticTabs);
+}
+
+String SvxTPView::GetMyName() const
+{
+ return aStrMyName;
+}
+
+void SvxTPView::Resize()
+{
+ Size aSize=GetOutputSizePixel();
+ Point aPos=aViewData.GetPosPixel();
+ aSize.Height()-=aPos.Y()+nDistance;
+ aSize.Width()-=2*aPos.X();
+
+ long newY=aPos.Y()+aSize.Height()+MIN_DISTANCE;
+ aPos=PbAccept.GetPosPixel();
+ aPos.Y()=newY;
+ PbAccept.SetPosPixel(aPos);
+ aPos=PbAcceptAll.GetPosPixel();
+ aPos.Y()=newY;
+ PbAcceptAll.SetPosPixel(aPos);
+ aPos=PbReject.GetPosPixel();
+ aPos.Y()=newY;
+ PbReject.SetPosPixel(aPos);
+ aPos=PbRejectAll.GetPosPixel();
+ aPos.Y()=newY;
+ PbRejectAll.SetPosPixel(aPos);
+
+ if(PbUndo.IsVisible())
+ {
+ aPos=PbUndo.GetPosPixel();
+ aPos.Y()=newY;
+ PbUndo.SetPosPixel(aPos);
+ }
+ aViewData.SetSizePixel(aSize);
+}
+
+void SvxTPView::InsertWriterHeader()
+{
+ String aStrTab(sal_Unicode('\t'));
+ String aString(aTitle1);
+ aString+=aStrTab;
+ aString+=aTitle3;
+ aString+=aStrTab;
+ aString+=aTitle4;
+ aString+=aStrTab;
+ aString+=aTitle5;
+ aViewData.ClearHeader();
+ aViewData.InsertHeaderEntry(aString);
+}
+
+void SvxTPView::InsertCalcHeader()
+{
+ String aStrTab(sal_Unicode('\t'));
+ String aString(aTitle1);
+ aString+=aStrTab;
+ aString+=aTitle2;
+ aString+=aStrTab;
+ aString+=aTitle3;
+ aString+=aStrTab;
+ aString+=aTitle4;
+ aString+=aStrTab;
+ aString+=aTitle5;
+ aViewData.ClearHeader();
+ aViewData.InsertHeaderEntry(aString);
+}
+
+void SvxTPView::EnableAccept(sal_Bool nFlag)
+{
+ PbAccept.Enable(nFlag);
+}
+
+void SvxTPView::EnableAcceptAll(sal_Bool nFlag)
+{
+ PbAcceptAll.Enable(nFlag);
+}
+
+void SvxTPView::EnableReject(sal_Bool nFlag)
+{
+ PbReject.Enable(nFlag);
+}
+
+void SvxTPView::EnableRejectAll(sal_Bool nFlag)
+{
+ PbRejectAll.Enable(nFlag);
+}
+
+void SvxTPView::ShowUndo(sal_Bool nFlag)
+{
+ PbUndo.Show(nFlag);
+}
+
+void SvxTPView::EnableUndo(sal_Bool nFlag)
+{
+ PbUndo.Enable(nFlag);
+}
+
+Size SvxTPView::GetMinSizePixel()
+{
+ Size aSize=aMinSize;
+ if(PbUndo.IsVisible())
+ {
+ sal_uIntPtr nSize=PbUndo.GetSizePixel().Width()
+ +PbUndo.GetPosPixel().X()
+ +PbAccept.GetPosPixel().X();
+
+ aSize.Width()=nSize;
+ }
+
+ return aSize;
+}
+
+
+SvxRedlinTable* SvxTPView::GetTableControl()
+{
+ return &aViewData;
+}
+
+IMPL_LINK( SvxTPView, PbClickHdl, PushButton*, pPushB )
+{
+ if(pPushB==&PbAccept)
+ {
+ AcceptClickLk.Call(this);
+ }
+ else if(pPushB==&PbAcceptAll)
+ {
+ AcceptAllClickLk.Call(this);
+ }
+ else if(pPushB==&PbReject)
+ {
+ RejectClickLk.Call(this);
+ }
+ else if(pPushB==&PbRejectAll)
+ {
+ RejectAllClickLk.Call(this);
+ }
+ else if(pPushB==&PbUndo)
+ {
+ UndoClickLk.Call(this);
+ }
+
+ return 0;
+}
+
+
+
+
+//============================================================================
+// class SvxTPFilter
+//----------------------------------------------------------------------------
+
+SvxTPFilter::SvxTPFilter( Window * pParent)
+ : TabPage( pParent, SVX_RES(SID_REDLIN_FILTER_PAGE)),
+ pRedlinTable(NULL),
+ aCbDate ( this, SVX_RES( CB_DATE ) ),
+ aLbDate ( this, SVX_RES( LB_DATE ) ),
+ aDfDate ( this, SVX_RES( DF_DATE ) ),
+ aTfDate ( this, SVX_RES( TF_DATE ) ),
+ aIbClock ( this, SVX_RES( IB_CLOCK ) ),
+ aFtDate2 ( this, SVX_RES( FT_DATE2 ) ),
+ aDfDate2 ( this, SVX_RES( DF_DATE2 ) ),
+ aTfDate2 ( this, SVX_RES( TF_DATE2 ) ),
+ aIbClock2 ( this, SVX_RES( IB_CLOCK2) ),
+ aCbAuthor ( this, SVX_RES( CB_AUTOR ) ),
+ aLbAuthor ( this, SVX_RES( LB_AUTOR ) ),
+ aCbRange ( this, SVX_RES( CB_RANGE ) ),
+ aEdRange ( this, SVX_RES( ED_RANGE ) ),
+ aBtnRange ( this, SVX_RES( BTN_REF ) ),
+ aLbAction ( this, SVX_RES( LB_ACTION ) ),
+ aCbComment ( this, SVX_RES( CB_COMMENT) ),
+ aEdComment ( this, SVX_RES( ED_COMMENT) ),
+ aActionStr ( SVX_RES( STR_ACTION) ),
+ aStrMyName ( SVX_RES( STR_FILTER) ),
+ bModified (sal_False)
+{
+ Image aImgTimeHC( SVX_RES( IMG_TIME_H ) );
+ FreeResource();
+
+ aIbClock.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST );
+ aIbClock2.SetModeImage( aImgTimeHC, BMP_COLOR_HIGHCONTRAST );
+
+ aDfDate.SetShowDateCentury( sal_True );
+ aDfDate2.SetShowDateCentury( sal_True );
+
+ aRangeStr=aCbRange.GetText();
+ aLbDate.SelectEntryPos(0);
+ aLbDate.SetSelectHdl( LINK( this, SvxTPFilter, SelDateHdl ) );
+ aIbClock.SetClickHdl( LINK( this, SvxTPFilter, TimeHdl) );
+ aIbClock2.SetClickHdl( LINK( this, SvxTPFilter,TimeHdl) );
+ aBtnRange.SetClickHdl( LINK( this, SvxTPFilter, RefHandle));
+
+ Link aLink=LINK( this, SvxTPFilter, RowEnableHdl) ;
+ aCbDate.SetClickHdl(aLink);
+ aCbAuthor.SetClickHdl(aLink);
+ aCbRange.SetClickHdl(aLink);
+ aCbComment.SetClickHdl(aLink);
+
+ Link a2Link=LINK( this, SvxTPFilter, ModifyDate);
+ aDfDate.SetModifyHdl(a2Link);
+ aTfDate.SetModifyHdl(a2Link);
+ aDfDate2.SetModifyHdl(a2Link);
+ aTfDate2.SetModifyHdl(a2Link);
+
+ Link a3Link=LINK( this, SvxTPFilter, ModifyHdl);
+ aEdRange.SetModifyHdl(a3Link);
+ aEdComment.SetModifyHdl(a3Link);
+ aLbAction.SetSelectHdl(a3Link);
+ aLbAuthor.SetSelectHdl(a3Link);
+
+ RowEnableHdl(&aCbDate);
+ RowEnableHdl(&aCbAuthor);
+ RowEnableHdl(&aCbRange);
+ RowEnableHdl(&aCbComment);
+
+ Date aDate;
+ Time aTime;
+ aDfDate.SetDate(aDate);
+ aTfDate.SetTime(aTime);
+ aDfDate2.SetDate(aDate);
+ aTfDate2.SetTime(aTime);
+ HideRange();
+ ShowAction();
+ bModified=sal_False;
+}
+
+void SvxTPFilter::SetRedlinTable(SvxRedlinTable* pTable)
+{
+ pRedlinTable=pTable;
+}
+
+String SvxTPFilter::GetMyName() const
+{
+ return aStrMyName;
+}
+
+void SvxTPFilter::DisableRange(sal_Bool bFlag)
+{
+ if(bFlag)
+ {
+ aCbRange.Disable();
+ aEdRange.Disable();
+ aBtnRange.Disable();
+ }
+ else
+ {
+ aCbRange.Enable();
+ aEdRange.Enable();
+ aBtnRange.Enable();
+ }
+}
+
+void SvxTPFilter::ShowDateFields(sal_uInt16 nKind)
+{
+ String aEmpty;
+ switch(nKind)
+ {
+ case FLT_DATE_BEFORE:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_SINCE:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_EQUAL:
+ EnableDateLine1(sal_True);
+ aTfDate.Disable();
+ aTfDate.SetText(aEmpty);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_NOTEQUAL:
+ EnableDateLine1(sal_True);
+ aTfDate.Disable();
+ aTfDate.SetText(aEmpty);
+ EnableDateLine2(sal_False);
+ break;
+ case FLT_DATE_BETWEEN:
+ EnableDateLine1(sal_True);
+ EnableDateLine2(sal_True);
+ break;
+ case FLT_DATE_SAVE:
+ EnableDateLine1(sal_False);
+ EnableDateLine2(sal_False);
+ break;
+ }
+}
+
+void SvxTPFilter::EnableDateLine1(sal_Bool bFlag)
+{
+ if(bFlag && aCbDate.IsChecked())
+ {
+ aDfDate.Enable();
+ aTfDate.Enable();
+ aIbClock.Enable();
+ }
+ else
+ {
+ aDfDate.Disable();
+ aTfDate.Disable();
+ aIbClock.Disable();
+ }
+}
+void SvxTPFilter::EnableDateLine2(sal_Bool bFlag)
+{
+ String aEmpty;
+ if(bFlag && aCbDate.IsChecked())
+ {
+ aFtDate2.Enable();
+ aDfDate2.Enable();
+ aTfDate2.Enable();
+ aIbClock2.Enable();
+ }
+ else
+ {
+ aFtDate2.Disable();
+ aDfDate2.Disable();
+ aDfDate2.SetText(aEmpty);
+ aTfDate2.Disable();
+ aTfDate2.SetText(aEmpty);
+ aIbClock2.Disable();
+ }
+}
+
+Date SvxTPFilter::GetFirstDate() const
+{
+ return aDfDate.GetDate();
+}
+
+void SvxTPFilter::SetFirstDate(const Date &aDate)
+{
+ aDfDate.SetDate(aDate);
+}
+
+Time SvxTPFilter::GetFirstTime() const
+{
+ return aTfDate.GetTime();
+}
+
+void SvxTPFilter::SetFirstTime(const Time &aTime)
+{
+ aTfDate.SetTime(aTime);
+}
+
+
+Date SvxTPFilter::GetLastDate() const
+{
+ return aDfDate2.GetDate();
+}
+
+void SvxTPFilter::SetLastDate(const Date &aDate)
+{
+ aDfDate2.SetDate(aDate);
+}
+
+Time SvxTPFilter::GetLastTime() const
+{
+ return aTfDate2.GetTime();
+}
+
+void SvxTPFilter::SetLastTime(const Time &aTime)
+{
+ aTfDate2.SetTime(aTime);
+}
+
+void SvxTPFilter::SetDateMode(sal_uInt16 nMode)
+{
+ aLbDate.SelectEntryPos(nMode);
+ SelDateHdl(&aLbDate);
+}
+
+sal_uInt16 SvxTPFilter::GetDateMode()
+{
+ return (sal_uInt16) aLbDate.GetSelectEntryPos();
+}
+void SvxTPFilter::ClearAuthors()
+{
+ aLbAuthor.Clear();
+}
+
+void SvxTPFilter::InsertAuthor( const String& rString, sal_uInt16 nPos)
+{
+ aLbAuthor.InsertEntry(rString,nPos);
+}
+
+String SvxTPFilter::GetSelectedAuthor() const
+{
+ return aLbAuthor.GetSelectEntry();
+}
+
+sal_uInt16 SvxTPFilter::GetSelectedAuthorPos()
+{
+ return (sal_uInt16) aLbAuthor.GetSelectEntryPos();
+}
+
+void SvxTPFilter::SelectedAuthorPos(sal_uInt16 nPos)
+{
+ aLbAuthor.SelectEntryPos(nPos);
+}
+
+sal_uInt16 SvxTPFilter::SelectAuthor(const String& aString)
+{
+ aLbAuthor.SelectEntry(aString);
+ return aLbAuthor.GetSelectEntryPos();
+}
+
+void SvxTPFilter::SetRange(const String& rString)
+{
+ aEdRange.SetText(rString);
+}
+
+String SvxTPFilter::GetRange() const
+{
+ return aEdRange.GetText();
+}
+
+void SvxTPFilter::SetFocusToRange()
+{
+ aEdRange.GrabFocus();
+}
+
+void SvxTPFilter::HideRange(sal_Bool bHide)
+{
+ if(bHide)
+ {
+ aCbRange.Hide();
+ aEdRange.Hide();
+ aBtnRange.Hide();
+ }
+ else
+ {
+ ShowAction(sal_False);
+ aCbRange.SetText(aRangeStr);
+ aCbRange.Show();
+ aEdRange.Show();
+ aBtnRange.Show();
+ }
+}
+
+void SvxTPFilter::HideClocks(sal_Bool bHide)
+{
+ if(bHide)
+ {
+ aIbClock. Hide();
+ aIbClock2.Hide();
+ }
+ else
+ {
+ aIbClock. Show();
+ aIbClock2.Show();
+ }
+}
+
+void SvxTPFilter::SetComment(const String &rComment)
+{
+ aEdComment.SetText(rComment);
+}
+String SvxTPFilter::GetComment()const
+{
+ return aEdComment.GetText();
+}
+
+sal_Bool SvxTPFilter::IsDate()
+{
+ return aCbDate.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsAuthor()
+{
+ return aCbAuthor.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsRange()
+{
+ return aCbRange.IsChecked();
+}
+sal_Bool SvxTPFilter::IsAction()
+{
+ return aCbRange.IsChecked();
+}
+
+sal_Bool SvxTPFilter::IsComment()
+{
+ return aCbComment.IsChecked();
+}
+
+void SvxTPFilter::CheckDate(sal_Bool bFlag)
+{
+ aCbDate.Check(bFlag);
+ RowEnableHdl(&aCbDate);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckAuthor(sal_Bool bFlag)
+{
+ aCbAuthor.Check(bFlag);
+ RowEnableHdl(&aCbAuthor);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckRange(sal_Bool bFlag)
+{
+ aCbRange.Check(bFlag);
+ RowEnableHdl(&aCbRange);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckAction(sal_Bool bFlag)
+{
+ aCbRange.Check(bFlag);
+ RowEnableHdl(&aCbRange);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::CheckComment(sal_Bool bFlag)
+{
+ aCbComment.Check(bFlag);
+ RowEnableHdl(&aCbComment);
+ bModified=sal_False;
+}
+
+void SvxTPFilter::ShowAction(sal_Bool bShow)
+{
+ if(!bShow)
+ {
+ aCbRange.Hide();
+ aLbAction.Hide();
+ aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_RANGE);
+ }
+ else
+ {
+ HideRange();
+ aCbRange.SetText(aActionStr);
+ aCbRange.SetHelpId(HID_REDLINING_FILTER_CB_ACTION);
+ aCbRange.Show();
+ aLbAction.Show();
+
+ }
+}
+
+ListBox* SvxTPFilter::GetLbAction()
+{
+ return &aLbAction;
+}
+
+IMPL_LINK( SvxTPFilter, SelDateHdl, ListBox*, pLb )
+{
+ ShowDateFields((sal_uInt16)aLbDate.GetSelectEntryPos());
+ ModifyHdl(pLb);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, RowEnableHdl, CheckBox*, pCB )
+{
+ if(pCB==&aCbDate)
+ {
+ aLbDate.Enable(aCbDate.IsChecked());
+ aLbDate.Invalidate();
+ EnableDateLine1(sal_False);
+ EnableDateLine2(sal_False);
+ if(aCbDate.IsChecked()) SelDateHdl(&aLbDate);
+ }
+ else if(pCB==&aCbAuthor)
+ {
+ aLbAuthor.Enable(aCbAuthor.IsChecked());
+ aLbAuthor.Invalidate();
+ }
+ else if(pCB==&aCbRange)
+ {
+ aLbAction.Enable(aCbRange.IsChecked());
+ aLbAction.Invalidate();
+ aEdRange.Enable(aCbRange.IsChecked());
+ aBtnRange.Enable(aCbRange.IsChecked());
+ }
+ else if(pCB==&aCbComment)
+ {
+ aEdComment.Enable(aCbComment.IsChecked());
+ aEdComment.Invalidate();
+ }
+
+ ModifyHdl(pCB);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, TimeHdl, ImageButton*,pIB )
+{
+ Date aDate;
+ Time aTime;
+ if(pIB==&aIbClock)
+ {
+ aDfDate.SetDate(aDate);
+ aTfDate.SetTime(aTime);
+ }
+ else if(pIB==&aIbClock2)
+ {
+ aDfDate2.SetDate(aDate);
+ aTfDate2.SetTime(aTime);
+ }
+ ModifyHdl(&aDfDate);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, ModifyHdl, void*, pCtr)
+{
+ if(pCtr!=NULL)
+ {
+ if(pCtr==&aCbDate || pCtr==&aLbDate ||
+ pCtr==&aDfDate || pCtr==&aTfDate ||
+ pCtr==&aIbClock || pCtr==&aFtDate2||
+ pCtr==&aDfDate2 || pCtr==&aTfDate2||
+ pCtr==&aIbClock2)
+ {
+ aModifyDateLink.Call(this);
+ }
+ else if(pCtr==&aCbAuthor || pCtr==&aLbAuthor)
+ {
+ aModifyAuthorLink.Call(this);
+ }
+ else if(pCtr==&aCbRange || pCtr==&aEdRange ||
+ pCtr==&aBtnRange )
+ {
+ aModifyRefLink.Call(this);
+ }
+ else if(pCtr==&aCbComment || pCtr==&aEdComment)
+ {
+ aModifyComLink.Call(this);
+ }
+
+ bModified=sal_True;
+ aModifyLink.Call(this);
+ }
+ return 0;
+}
+
+void SvxTPFilter::DeactivatePage()
+{
+ if(bModified)
+ {
+ if(pRedlinTable!=NULL)
+ {
+ pRedlinTable->SetFilterDate(IsDate());
+ pRedlinTable->SetDateTimeMode(GetDateMode());
+ pRedlinTable->SetFirstDate(aDfDate.GetDate());
+ pRedlinTable->SetLastDate(aDfDate2.GetDate());
+ pRedlinTable->SetFirstTime(aTfDate.GetTime());
+ pRedlinTable->SetLastTime(aTfDate2.GetTime());
+ pRedlinTable->SetFilterAuthor(IsAuthor());
+ pRedlinTable->SetAuthor(GetSelectedAuthor());
+
+ pRedlinTable->SetFilterComment(IsComment());
+
+ utl::SearchParam aSearchParam( aEdComment.GetText(),
+ utl::SearchParam::SRCH_REGEXP,sal_False,sal_False,sal_False );
+
+ pRedlinTable->SetCommentParams(&aSearchParam);
+
+ pRedlinTable->UpdateFilterTest();
+ }
+
+ aReadyLink.Call(this);
+ }
+ bModified=sal_False;
+ TabPage::DeactivatePage();
+}
+
+void SvxTPFilter::Enable( bool bEnable, bool bChild)
+{
+ TabPage::Enable(bEnable,bChild);
+ if(aCbDate.IsEnabled())
+ {
+ RowEnableHdl(&aCbDate);
+ RowEnableHdl(&aCbAuthor);
+ RowEnableHdl(&aCbRange);
+ RowEnableHdl(&aCbComment);
+ }
+}
+void SvxTPFilter::Disable( bool bChild)
+{
+ Enable( false, bChild );
+}
+
+IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
+{
+
+ Date aDate;
+ Time aTime(0);
+ if(&aDfDate==pTF)
+ {
+ if(aDfDate.GetText().Len()==0)
+ aDfDate.SetDate(aDate);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetFirstDate(aDfDate.GetDate());
+ }
+ else if(&aDfDate2==pTF)
+ {
+ if(aDfDate2.GetText().Len()==0)
+ aDfDate2.SetDate(aDate);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetLastDate(aDfDate2.GetDate());
+ }
+ else if(&aTfDate==pTF)
+ {
+ if(aTfDate.GetText().Len()==0)
+ aTfDate.SetTime(aTime);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetFirstTime(aTfDate.GetTime());
+ }
+ else if(&aTfDate2==pTF)
+ {
+ if(aTfDate2.GetText().Len()==0)
+ aTfDate2.SetTime(aTime);
+
+ if(pRedlinTable!=NULL)
+ pRedlinTable->SetLastTime(aTfDate2.GetTime());
+
+ }
+ ModifyHdl(&aDfDate);
+ return 0;
+}
+
+IMPL_LINK( SvxTPFilter, RefHandle, PushButton*, pRef )
+{
+ if(pRef!=NULL)
+ {
+ aRefLink.Call(this);
+ }
+ return 0;
+}
+
+static Size gDiffSize;
+//============================================================================
+// class SvxAcceptChgCtr
+//----------------------------------------------------------------------------
+
+SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, WinBits nWinStyle)
+ : Control(pParent,nWinStyle |WB_DIALOGCONTROL),
+ aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL)
+{
+ pTPFilter=new SvxTPFilter(&aTCAccept);
+ pTPView=new SvxTPView(&aTCAccept);
+ aMinSize=pTPView->GetMinSizePixel();
+
+ aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName());
+ aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName());
+ aTCAccept.SetTabPage( TP_VIEW, pTPView);
+ aTCAccept.SetTabPage( TP_FILTER, pTPFilter);
+ aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL);
+
+ aTCAccept.SetTabPageSizePixel(aMinSize);
+ Size aSize=aTCAccept.GetSizePixel();
+
+ gDiffSize.Height()=aSize.Height()-aMinSize.Height();
+ gDiffSize.Width()=aSize.Width()-aMinSize.Width();
+
+
+ pTPFilter->SetRedlinTable(GetViewTable());
+
+ aTCAccept.Show();
+ ShowViewPage();
+}
+
+SvxAcceptChgCtr::SvxAcceptChgCtr( Window* pParent, const ResId& rResId )
+ : Control(pParent,rResId ),
+ aTCAccept(this,WB_TABSTOP |WB_DIALOGCONTROL)
+{
+ pTPFilter=new SvxTPFilter(&aTCAccept);
+ pTPView=new SvxTPView(&aTCAccept);
+ aMinSize=pTPView->GetMinSizePixel();
+
+ aTCAccept.InsertPage( TP_VIEW, pTPView->GetMyName());
+ aTCAccept.InsertPage( TP_FILTER, pTPFilter->GetMyName());
+ aTCAccept.SetTabPage( TP_VIEW, pTPView);
+ aTCAccept.SetTabPage( TP_FILTER, pTPFilter);
+ aTCAccept.SetHelpId(HID_REDLINING_TABCONTROL);
+
+ aTCAccept.SetTabPageSizePixel(aMinSize);
+ Size aSize=aTCAccept.GetSizePixel();
+
+ gDiffSize.Height()=aSize.Height()-aMinSize.Height();
+ gDiffSize.Width()=aSize.Width()-aMinSize.Width();
+
+
+ pTPFilter->SetRedlinTable(GetViewTable());
+ WinBits nWinStyle=GetStyle()|WB_DIALOGCONTROL;
+ SetStyle(nWinStyle);
+
+ aTCAccept.Show();
+ ShowViewPage();
+ Resize();
+}
+
+SvxAcceptChgCtr::~SvxAcceptChgCtr()
+{
+ delete pTPView;
+ delete pTPFilter;
+}
+
+void SvxAcceptChgCtr::Resize()
+{
+ aMinSize=pTPView->GetMinSizePixel();
+ Size aSize=GetOutputSizePixel();
+ sal_Bool bFlag=sal_False;
+
+ if(aMinSize.Height()>aSize.Height())
+ {
+ aSize.Height()=aMinSize.Height();
+ bFlag=sal_True;
+ }
+ if(aMinSize.Width()>aSize.Width())
+ {
+ aSize.Width()=aMinSize.Width();
+ bFlag=sal_True;
+ }
+
+ if(bFlag)
+ {
+ SetOutputSizePixel(aSize);
+ aMinSizeLink.Call(this);
+ }
+
+ aSize.Height()-=2;
+ aSize.Width()-=2;
+ aTCAccept.SetSizePixel(aSize);
+}
+
+Size SvxAcceptChgCtr::GetMinSizePixel() const
+{
+ Size aSize=pTPView->GetMinSizePixel();
+ aSize.Height()+=gDiffSize.Height();
+ aSize.Width()+=gDiffSize.Width();
+ return aSize;
+}
+
+void SvxAcceptChgCtr::ShowFilterPage()
+{
+ aTCAccept.SetCurPageId(TP_FILTER);
+}
+
+void SvxAcceptChgCtr::ShowViewPage()
+{
+ aTCAccept.SetCurPageId(TP_VIEW);
+}
+
+sal_Bool SvxAcceptChgCtr::IsFilterPageVisible()
+{
+ return (aTCAccept.GetCurPageId()==TP_FILTER);
+}
+
+sal_Bool SvxAcceptChgCtr::IsViewPageVisible()
+{
+ return (aTCAccept.GetCurPageId()==TP_VIEW);
+}
+
+SvxTPFilter* SvxAcceptChgCtr::GetFilterPage()
+{
+ return pTPFilter;
+}
+
+SvxTPView* SvxAcceptChgCtr::GetViewPage()
+{
+ return pTPView;
+}
+
+SvxRedlinTable* SvxAcceptChgCtr::GetViewTable()
+{
+ if(pTPView!=NULL)
+ {
+ return pTPView->GetTableControl();
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+
diff --git a/svx/source/dialog/ctredlin.hrc b/svx/source/dialog/ctredlin.hrc
new file mode 100644
index 000000000000..23cc504c0573
--- /dev/null
+++ b/svx/source/dialog/ctredlin.hrc
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc> // ->SID_REDLIN_FILTER_PAGE
+ // ->SID_REDLIN_VIEW_PAGE
+
+#define TP_FILTER 11
+#define TP_VIEW 12
+
+#define LB_DATE 1
+#define DF_DATE 2
+#define TF_DATE 3
+#define LB_AUTOR 4
+#define ED_RANGE 5
+#define IB_CLOCK 6
+#define BTN_REF 7
+#define CB_DATE 8
+#define CB_AUTOR 9
+#define CB_RANGE 10
+#define FT_DATE2 12
+#define DF_DATE2 13
+#define TF_DATE2 14
+#define IB_CLOCK2 15
+#define STR_FILTER 16
+#define STR_ACTION 17
+#define LB_ACTION 18
+#define CB_COMMENT 19
+#define ED_COMMENT 20
+#define IMG_TIME_H 30
+
+#define HG_VIEW 1
+#define DG_VIEW 2
+#define PB_ACCEPT 3
+#define PB_ACCEPTALL 4
+#define PB_REJECT 5
+#define PB_REJECTALL 6
+#define PB_UNDO 7
+#define STR_VIEW 8
+
+#define STR_TITLE1 1
+#define STR_TITLE2 2
+#define STR_TITLE3 3
+#define STR_TITLE4 4
+#define STR_TITLE5 5
+//
+
diff --git a/svx/source/dialog/ctredlin.src b/svx/source/dialog/ctredlin.src
new file mode 100644
index 000000000000..e617607ebfad
--- /dev/null
+++ b/svx/source/dialog/ctredlin.src
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ctredlin.hrc"
+#include "helpid.hrc"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+TabPage SID_REDLIN_FILTER_PAGE
+{
+ String STR_FILTER
+ {
+ Text [ en-US ] = "Filter" ;
+ };
+ HelpId = HID_REDLINING_FILTER_PAGE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 261 , 86 ) ;
+ Hide = TRUE ;
+ CheckBox CB_DATE
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ HelpId = HID_REDLINING_FILTER_CB_DATE ;
+ Text [ en-US ] = "~Date" ;
+ };
+ ListBox LB_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_LB_DATE ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 6 ) ;
+ Size = MAP_APPFONT ( 78 , 99 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "earlier than" ; Default ; > ;
+ < "since" ; Default ; > ;
+ < "equal to " ; Default ; > ;
+ < "not equal to" ; Default ; > ;
+ < "between" ; Default ; > ;
+ < "since saving" ; Default ; > ;
+ };
+ };
+ DateField DF_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_DF_DATE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 144 , 6 ) ;
+ Size = MAP_APPFONT ( 57 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Minimum = Date
+ {
+ Year = 1985 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ Maximum = Date
+ {
+ Year = 2050 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ };
+ TimeField TF_DATE
+ {
+ HelpId = HID_REDLINING_FILTER_TF_DATE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 203 , 6 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ };
+ ImageButton IB_CLOCK
+ {
+ HelpId = HID_REDLINING_FILTER_IB_CLOCK ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 240 , 5 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "time.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Set Date/Time" ;
+ };
+ FixedText FT_DATE2
+ {
+ Pos = MAP_APPFONT ( 60 , 24 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Right = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "and" ;
+ };
+ DateField DF_DATE2
+ {
+ HelpId = HID_REDLINING_FILTER_DF_DATE2 ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 144 , 22 ) ;
+ Size = MAP_APPFONT ( 57 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Minimum = Date
+ {
+ Year = 1985 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ Maximum = Date
+ {
+ Year = 2050 ;
+ Month = 12 ;
+ Day = 31 ;
+ };
+ };
+ TimeField TF_DATE2
+ {
+ HelpId = HID_REDLINING_FILTER_TF_DATE2 ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 203 , 22 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ };
+ ImageButton IB_CLOCK2
+ {
+ HelpId = HID_REDLINING_FILTER_IB_CLOCK2 ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 240 , 21 ) ;
+ Size = MAP_APPFONT ( 13 , 15 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap { File = "time.bmp" ; };
+ MASKCOLOR
+ };
+ QuickHelpText [ en-US ] = "Set Date/Time" ;
+ };
+ CheckBox CB_AUTOR
+ {
+ HelpId = HID_REDLINING_FILTER_CB_AUTOR ;
+ Pos = MAP_APPFONT ( 6 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Author" ;
+ };
+ ListBox LB_AUTOR
+ {
+ HelpId = HID_REDLINING_FILTER_LB_AUTOR ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 38 ) ;
+ Size = MAP_APPFONT ( 178 , 100 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_RANGE
+ {
+ HelpId = HID_REDLINING_FILTER_CB_RANGE ;
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Range" ;
+ };
+ Edit ED_RANGE
+ {
+ HelpId = HID_REDLINING_FILTER_ED_RANGE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 54 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_ACTION
+ {
+ Text [ en-US ] = "A~ction" ;
+ };
+ ListBox LB_ACTION
+ {
+ HelpId = HID_REDLINING_FILTER_LB_ACTION ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 54 ) ;
+ Size = MAP_APPFONT ( 178 , 100 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ PushButton BTN_REF
+ {
+ HelpId = HID_REDLINING_FILTER_BTN_REF ;
+ Pos = MAP_APPFONT ( 240 , 54 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ QuickHelpText [ en-US ] = "Set Reference" ;
+ Text [ en-US ] = "..." ;
+ };
+ CheckBox CB_COMMENT
+ {
+ HelpId = HID_REDLINING_FILTER_CB_COMMENT ;
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Comment";
+ };
+ Edit ED_COMMENT
+ {
+ HelpId = HID_REDLINING_FILTER_ED_COMMENT ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 70 ) ;
+ Size = MAP_APPFONT ( 178 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ Image IMG_TIME_H
+ {
+ ImageBitmap = Bitmap { File = "time_h.bmp" ; };
+ MASKCOLOR
+ };
+};
+TabPage SID_REDLIN_VIEW_PAGE
+{
+ HelpId = HID_REDLINING_VIEW_PAGE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 270 , 126 ) ;
+ Hide = TRUE ;
+ String STR_VIEW
+ {
+ Text [ en-US ] = "List" ;
+ };
+ Control DG_VIEW
+ {
+ HelpId = HID_REDLINING_VIEW_DG_VIEW ;
+ Pos = MAP_APPFONT ( 3 , 1 ) ;
+ Size = MAP_APPFONT ( 221 , 65 ) ;
+ Border = TRUE ;
+ };
+ PushButton PB_ACCEPT
+ {
+ HelpId = HID_REDLINING_VIEW_PB_ACCEPT ;
+ Pos = MAP_APPFONT ( 3 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Accept" ;
+ };
+ PushButton PB_REJECT
+ {
+ HelpId = HID_REDLINING_VIEW_PB_REJECT ;
+ Pos = MAP_APPFONT ( 69 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Reject" ;
+ };
+ PushButton PB_ACCEPTALL
+ {
+ HelpId = HID_REDLINING_VIEW_PB_ACCEPTALL ;
+ Pos = MAP_APPFONT ( 141 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "A~ccept All" ;
+ };
+ PushButton PB_REJECTALL
+ {
+ HelpId = HID_REDLINING_VIEW_PB_REJECTALL ;
+ Pos = MAP_APPFONT ( 207 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "R~eject All" ;
+ };
+
+ PushButton PB_UNDO
+ {
+ HelpId = HID_REDLINING_VIEW_PB_UNDO ;
+ Hide = TRUE;
+ Pos = MAP_APPFONT ( 279 , 69 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Undo";
+ };
+ String STR_TITLE1
+ {
+ Text [ en-US ] = "Action" ;
+ };
+ String STR_TITLE2
+ {
+ Text [ en-US ] = "Position" ;
+ };
+ String STR_TITLE3
+ {
+ Text [ en-US ] = "Author" ;
+ };
+ String STR_TITLE4
+ {
+ Text [ en-US ] = "Date" ;
+ };
+ String STR_TITLE5
+ {
+ Text [ en-US ] = "Comment" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/databaseregistrationui.cxx b/svx/source/dialog/databaseregistrationui.cxx
new file mode 100644
index 000000000000..4a4088c47253
--- /dev/null
+++ b/svx/source/dialog/databaseregistrationui.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// === includes (declaration) ============================================
+#include "svx/databaseregistrationui.hxx"
+
+// === includes (UNO) ====================================================
+// === /includes (UNO) ===================================================
+
+// === includes (project) ================================================
+#include <svx/svxdlg.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+//#include "connpooloptions.hxx"
+// === /includes (project) ===============================================
+
+// === includes (global) =================================================
+#include <sfx2/app.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/msgbox.hxx>
+// === /includes (global) ================================================
+
+namespace svx
+{
+ sal_uInt16 administrateDatabaseRegistration( Window* _parentWindow )
+ {
+ sal_uInt16 nResult = RET_CANCEL;
+
+ SfxItemSet aRegistrationItems( SFX_APP()->GetPool(), SID_SB_DB_REGISTER, SID_SB_DB_REGISTER, 0 );
+
+ SvxAbstractDialogFactory* pDialogFactory = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr< SfxAbstractDialog > pDialog;
+ if ( pDialogFactory )
+ pDialog.reset( pDialogFactory->CreateSfxDialog( _parentWindow, aRegistrationItems, NULL, RID_SFXPAGE_DBREGISTER ) );
+ if ( pDialog.get() )
+ nResult = pDialog->Execute();
+
+ return nResult;
+ }
+
+} // namespace svx
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
new file mode 100644
index 000000000000..2e5501e589af
--- /dev/null
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/dialcontrol.hxx"
+
+#include <math.h>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/field.hxx>
+#include <svtools/colorcfg.hxx>
+
+namespace svx {
+
+// ============================================================================
+
+const long DIAL_OUTER_WIDTH = 8;
+
+// ============================================================================
+
+class DialControlBmp : public VirtualDevice
+{
+public:
+ explicit DialControlBmp( Window& rParent );
+
+ void InitBitmap( const Size& rSize, const Font& rFont );
+ void CopyBackground( const DialControlBmp& rSrc );
+ void DrawBackground( const Size& rSize, bool bEnabled );
+ void DrawElements( const String& rText, sal_Int32 nAngle );
+
+private:
+ const Color& GetBackgroundColor() const;
+ const Color& GetTextColor() const;
+ const Color& GetScaleLineColor() const;
+ const Color& GetButtonLineColor() const;
+ const Color& GetButtonFillColor( bool bMain ) const;
+
+ void Init( const Size& rSize );
+ void DrawBackground();
+
+ Window& mrParent;
+ Rectangle maRect;
+ long mnCenterX;
+ long mnCenterY;
+ bool mbEnabled;
+};
+
+// ----------------------------------------------------------------------------
+
+DialControlBmp::DialControlBmp( Window& rParent ) :
+ VirtualDevice( rParent, 0, 0 ),
+ mrParent( rParent ),
+ mbEnabled( true )
+{
+ EnableRTL( sal_False );
+}
+
+void DialControlBmp::InitBitmap( const Size& rSize, const Font& rFont )
+{
+ Init( rSize );
+ SetFont( rFont );
+}
+
+void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
+{
+ Init( rSrc.maRect.GetSize() );
+ mbEnabled = rSrc.mbEnabled;
+ Point aPos;
+ DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
+}
+
+void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
+{
+ Init( rSize );
+ mbEnabled = bEnabled;
+ DrawBackground();
+}
+
+void DialControlBmp::DrawElements( const String& rText, sal_Int32 nAngle )
+{
+ // *** rotated text ***
+
+ Font aFont( GetFont() );
+ aFont.SetColor( GetTextColor() );
+ aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aFont );
+
+ double fAngle = nAngle * F_PI180 / 100.0;
+ double fSin = sin( fAngle );
+ double fCos = cos( fAngle );
+ double fWidth = GetTextWidth( rText ) / 2.0;
+ double fHeight = GetTextHeight() / 2.0;
+ long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin );
+ long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos );
+ Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY );
+ DrawText( aRect, rText, mbEnabled ? 0 : TEXT_DRAW_DISABLE );
+
+ // *** drag button ***
+
+ bool bMain = (nAngle % 4500) != 0;
+ SetLineColor( GetButtonLineColor() );
+ SetFillColor( GetButtonFillColor( bMain ) );
+
+ nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos );
+ nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin );
+ long nSize = bMain ? (DIAL_OUTER_WIDTH / 4) : (DIAL_OUTER_WIDTH / 2 - 1);
+ DrawEllipse( Rectangle( nX - nSize, nY - nSize, nX + nSize, nY + nSize ) );
+}
+
+// private --------------------------------------------------------------------
+
+const Color& DialControlBmp::GetBackgroundColor() const
+{
+ return GetSettings().GetStyleSettings().GetDialogColor();
+}
+
+const Color& DialControlBmp::GetTextColor() const
+{
+ return GetSettings().GetStyleSettings().GetLabelTextColor();
+}
+
+const Color& DialControlBmp::GetScaleLineColor() const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
+}
+
+const Color& DialControlBmp::GetButtonLineColor() const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
+}
+
+const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
+{
+ const StyleSettings& rSett = GetSettings().GetStyleSettings();
+ return mbEnabled ? (bMain ? rSett.GetMenuColor() : rSett.GetHighlightColor()) : rSett.GetDisableColor();
+}
+
+void DialControlBmp::Init( const Size& rSize )
+{
+ SetSettings( mrParent.GetSettings() );
+ maRect.SetPos( Point( 0, 0 ) );
+ maRect.SetSize( rSize );
+ mnCenterX = rSize.Width() / 2;
+ mnCenterY = rSize.Height() / 2;
+ SetOutputSize( rSize );
+ SetBackground();
+}
+
+void DialControlBmp::DrawBackground()
+{
+ // *** background with 3D effect ***
+
+ SetLineColor();
+ SetFillColor();
+ Erase();
+
+ EnableRTL( sal_True ); // #107807# draw 3D effect in correct direction
+
+ sal_uInt8 nDiff = mbEnabled ? 0x18 : 0x10;
+ Color aColor;
+
+ aColor = GetBackgroundColor();
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopRight(), maRect.TopCenter() );
+ DrawPie( maRect, maRect.BottomLeft(), maRect.BottomCenter() );
+
+ aColor.DecreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.BottomCenter(), maRect.TopRight() );
+
+ aColor.DecreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.BottomRight(), maRect.RightCenter() );
+
+ aColor = GetBackgroundColor();
+ aColor.IncreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopCenter(), maRect.BottomLeft() );
+
+ aColor.IncreaseLuminance( nDiff );
+ SetFillColor( aColor );
+ DrawPie( maRect, maRect.TopLeft(), maRect.LeftCenter() );
+
+ EnableRTL( sal_False );
+
+ // *** calibration ***
+
+ Point aStartPos( mnCenterX, mnCenterY );
+ Color aFullColor( GetScaleLineColor() );
+ Color aLightColor( GetBackgroundColor() );
+ aLightColor.Merge( aFullColor, 128 );
+
+ for( int nAngle = 0; nAngle < 360; nAngle += 15 )
+ {
+ SetLineColor( (nAngle % 45) ? aLightColor : aFullColor );
+ double fAngle = nAngle * F_PI180;
+ long nX = static_cast< long >( -mnCenterX * cos( fAngle ) );
+ long nY = static_cast< long >( mnCenterY * sin( fAngle ) );
+ DrawLine( aStartPos, Point( mnCenterX - nX, mnCenterY - nY ) );
+ }
+
+ // *** clear inner area ***
+
+ SetLineColor();
+ SetFillColor( GetBackgroundColor() );
+ DrawEllipse( Rectangle( maRect.Left() + DIAL_OUTER_WIDTH, maRect.Top() + DIAL_OUTER_WIDTH,
+ maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) );
+}
+
+// ============================================================================
+
+struct DialControl_Impl
+{
+ DialControlBmp maBmpEnabled;
+ DialControlBmp maBmpDisabled;
+ DialControlBmp maBmpBuffered;
+ Link maModifyHdl;
+ NumericField* mpLinkField;
+ Size maWinSize;
+ Font maWinFont;
+ sal_Int32 mnAngle;
+ sal_Int32 mnOldAngle;
+ long mnCenterX;
+ long mnCenterY;
+ bool mbNoRot;
+
+ explicit DialControl_Impl( Window& rParent );
+ void Init( const Size& rWinSize, const Font& rWinFont );
+};
+
+// ----------------------------------------------------------------------------
+
+DialControl_Impl::DialControl_Impl( Window& rParent ) :
+ maBmpEnabled( rParent ),
+ maBmpDisabled( rParent ),
+ maBmpBuffered( rParent ),
+ mpLinkField( 0 ),
+ mnAngle( 0 ),
+ mbNoRot( false )
+{
+}
+
+void DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
+{
+ // "(x - 1) | 1" creates odd value <= x, to have a well-defined center pixel position
+ maWinSize = Size( (rWinSize.Width() - 1) | 1, (rWinSize.Height() - 1) | 1 );
+ maWinFont = rWinFont;
+
+ mnCenterX = maWinSize.Width() / 2;
+ mnCenterY = maWinSize.Height() / 2;
+ maWinFont.SetTransparent( sal_True );
+
+ maBmpEnabled.DrawBackground( maWinSize, true );
+ maBmpDisabled.DrawBackground( maWinSize, false );
+ maBmpBuffered.InitBitmap( maWinSize, maWinFont );
+}
+
+// ============================================================================
+
+DialControl::DialControl( Window* pParent, const Size& rSize, const Font& rFont, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ Init( rSize, rFont );
+}
+
+DialControl::DialControl( Window* pParent, const Size& rSize, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ if( pParent )
+ Init( rSize, pParent->GetFont() );
+ else
+ Init( rSize );
+}
+
+DialControl::DialControl( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ mpImpl( new DialControl_Impl( *this ) )
+{
+ Init( GetOutputSizePixel() );
+}
+
+DialControl::~DialControl()
+{
+}
+
+void DialControl::Paint( const Rectangle& )
+{
+ Point aPos;
+ DrawBitmapEx( aPos, mpImpl->maBmpBuffered.GetBitmapEx( aPos, mpImpl->maWinSize ) );
+}
+
+void DialControl::StateChanged( StateChangedType nStateChange )
+{
+ if( nStateChange == STATE_CHANGE_ENABLE )
+ InvalidateControl();
+
+ // update the linked edit field
+ if( mpImpl->mpLinkField )
+ {
+ NumericField& rField = *mpImpl->mpLinkField;
+ switch( nStateChange )
+ {
+ case STATE_CHANGE_VISIBLE: rField.Show( IsVisible() ); break;
+ case STATE_CHANGE_ENABLE: rField.Enable( IsEnabled() ); break;
+ }
+ }
+
+ Control::StateChanged( nStateChange );
+}
+
+void DialControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Init( mpImpl->maWinSize, mpImpl->maWinFont );
+ InvalidateControl();
+ }
+ Control::DataChanged( rDCEvt );
+}
+
+void DialControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() )
+ {
+ GrabFocus();
+ CaptureMouse();
+ mpImpl->mnOldAngle = mpImpl->mnAngle;
+ HandleMouseEvent( rMEvt.GetPosPixel(), true );
+ }
+ Control::MouseButtonDown( rMEvt );
+}
+
+void DialControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if( IsMouseCaptured() && rMEvt.IsLeft() )
+ HandleMouseEvent( rMEvt.GetPosPixel(), false );
+ Control::MouseMove(rMEvt );
+}
+
+void DialControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if( IsMouseCaptured() )
+ {
+ ReleaseMouse();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->GrabFocus();
+ }
+ Control::MouseButtonUp( rMEvt );
+}
+
+void DialControl::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode& rKCode = rKEvt.GetKeyCode();
+ if( !rKCode.GetModifier() && (rKCode.GetCode() == KEY_ESCAPE) )
+ HandleEscapeEvent();
+ else
+ Control::KeyInput( rKEvt );
+}
+
+void DialControl::LoseFocus()
+{
+ // release captured mouse
+ HandleEscapeEvent();
+ Control::LoseFocus();
+}
+
+bool DialControl::HasRotation() const
+{
+ return !mpImpl->mbNoRot;
+}
+
+void DialControl::SetNoRotation()
+{
+ if( !mpImpl->mbNoRot )
+ {
+ mpImpl->mbNoRot = true;
+ InvalidateControl();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->SetText( String() );
+ }
+}
+
+sal_Int32 DialControl::GetRotation() const
+{
+ return mpImpl->mnAngle;
+}
+
+void DialControl::SetRotation( sal_Int32 nAngle )
+{
+ ImplSetRotation( nAngle, false );
+}
+
+void DialControl::SetLinkedField( NumericField* pField )
+{
+ // remove modify handler from old linked field
+ ImplSetFieldLink( Link() );
+ // remember the new linked field
+ mpImpl->mpLinkField = pField;
+ // set modify handler at new linked field
+ ImplSetFieldLink( LINK( this, DialControl, LinkedFieldModifyHdl ) );
+}
+
+NumericField* DialControl::GetLinkedField() const
+{
+ return mpImpl->mpLinkField;
+}
+
+void DialControl::SetModifyHdl( const Link& rLink )
+{
+ mpImpl->maModifyHdl = rLink;
+}
+
+const Link& DialControl::GetModifyHdl() const
+{
+ return mpImpl->maModifyHdl;
+}
+
+// private --------------------------------------------------------------------
+
+void DialControl::Init( const Size& rWinSize, const Font& rWinFont )
+{
+ mpImpl->Init( rWinSize, rWinFont );
+ EnableRTL( sal_False ); // #107807# don't mirror mouse handling
+ SetOutputSizePixel( mpImpl->maWinSize );
+ SetBackground();
+}
+
+void DialControl::Init( const Size& rWinSize )
+{
+ Font aFont( OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, Application::GetSettings().GetUILanguage(), DEFAULTFONT_FLAGS_ONLYONE ) );
+ Init( rWinSize, aFont );
+}
+
+void DialControl::InvalidateControl()
+{
+ mpImpl->maBmpBuffered.CopyBackground( IsEnabled() ? mpImpl->maBmpEnabled : mpImpl->maBmpDisabled );
+ if( !mpImpl->mbNoRot )
+ mpImpl->maBmpBuffered.DrawElements( GetText(), mpImpl->mnAngle );
+ Invalidate();
+}
+
+void DialControl::ImplSetRotation( sal_Int32 nAngle, bool bBroadcast )
+{
+ bool bOldSel = mpImpl->mbNoRot;
+ mpImpl->mbNoRot = false;
+
+ while( nAngle < 0 ) nAngle += 36000;
+ nAngle = (((nAngle + 50) / 100) * 100) % 36000;
+ if( !bOldSel || (mpImpl->mnAngle != nAngle) )
+ {
+ mpImpl->mnAngle = nAngle;
+ InvalidateControl();
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / 100 ) );
+ if( bBroadcast )
+ mpImpl->maModifyHdl.Call( this );
+ }
+}
+
+void DialControl::ImplSetFieldLink( const Link& rLink )
+{
+ if( mpImpl->mpLinkField )
+ {
+ NumericField& rField = *mpImpl->mpLinkField;
+ rField.SetModifyHdl( rLink );
+ rField.SetUpHdl( rLink );
+ rField.SetDownHdl( rLink );
+ rField.SetFirstHdl( rLink );
+ rField.SetLastHdl( rLink );
+ rField.SetLoseFocusHdl( rLink );
+ }
+}
+
+void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
+{
+ long nX = rPos.X() - mpImpl->mnCenterX;
+ long nY = mpImpl->mnCenterY - rPos.Y();
+ double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
+ if( fH != 0.0 )
+ {
+ double fAngle = acos( nX / fH );
+ sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 );
+ if( nY < 0 )
+ nAngle = 36000 - nAngle;
+ if( bInitial ) // round to entire 15 degrees
+ nAngle = ((nAngle + 750) / 1500) * 1500;
+ ImplSetRotation( nAngle, true );
+ }
+}
+
+void DialControl::HandleEscapeEvent()
+{
+ if( IsMouseCaptured() )
+ {
+ ReleaseMouse();
+ ImplSetRotation( mpImpl->mnOldAngle, true );
+ if( mpImpl->mpLinkField )
+ mpImpl->mpLinkField->GrabFocus();
+ }
+}
+
+IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField )
+{
+ if( pField )
+ ImplSetRotation( static_cast< sal_Int32 >( pField->GetValue() * 100 ), false );
+ return 0;
+}
+
+// ============================================================================
+
+DialControlWrapper::DialControlWrapper( DialControl& rDial ) :
+ SingleControlWrapperType( rDial )
+{
+}
+
+bool DialControlWrapper::IsControlDontKnow() const
+{
+ return !GetControl().HasRotation();
+}
+
+void DialControlWrapper::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ GetControl().SetNoRotation();
+}
+
+sal_Int32 DialControlWrapper::GetControlValue() const
+{
+ return GetControl().GetRotation();
+}
+
+void DialControlWrapper::SetControlValue( sal_Int32 nValue )
+{
+ GetControl().SetRotation( nValue );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/dialmgr.cxx b/svx/source/dialog/dialmgr.cxx
new file mode 100644
index 000000000000..c8e057ee8502
--- /dev/null
+++ b/svx/source/dialog/dialmgr.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+//#ifdef SVX_DLLIMPLEMENTATION
+//#undef SVX_DLLIMPLEMENTATION
+//#endif
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialmgr.hxx>
+#include <tools/rc.hxx>
+#include <svl/solar.hrc>
+#include <vcl/svapp.hxx>
+
+static ResMgr* pResMgr=0;
+
+// struct DialogsResMgr --------------------------------------------------
+ResMgr* DialogsResMgr::GetResMgr()
+{
+ if ( !pResMgr )
+ {
+ ByteString aName( "svx" );
+ pResMgr = ResMgr::CreateResMgr( aName.GetBuffer(), Application::GetSettings().GetUILocale() );
+ }
+
+ return pResMgr;
+}
diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx
new file mode 100644
index 000000000000..5f05d360007c
--- /dev/null
+++ b/svx/source/dialog/dlgctl3d.cxx
@@ -0,0 +1,1323 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dlgctl3d.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/view3d.hxx>
+#include <svx/fmmodel.hxx>
+#include <svl/itempool.hxx>
+#include <svx/fmpage.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/cube3d.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/helperhittest3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/polygn3d.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
+#include "helpid.hrc"
+#include <algorithm>
+
+//////////////////////////////////////////////////////////////////////////////
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
+{
+ Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
+}
+
+Svx3DPreviewControl::Svx3DPreviewControl(Window* pParent, WinBits nStyle)
+: Control(pParent, nStyle),
+ mpModel(0),
+ mpFmPage(0),
+ mp3DView(0),
+ mpScene(0),
+ mp3DObj(0),
+ mnObjectType(PREVIEW_OBJECTTYPE_SPHERE)
+{
+ Construct();
+
+ // do not paint background self, DrawingLayer paints this buffered and as page
+ SetControlBackground();
+ SetBackground();
+}
+
+Svx3DPreviewControl::~Svx3DPreviewControl()
+{
+ delete mp3DView;
+ delete mpModel;
+}
+
+void Svx3DPreviewControl::Construct()
+{
+ // Do never mirror the preview window. This explicitly includes right
+ // to left writing environments.
+ EnableRTL (sal_False);
+ SetMapMode( MAP_100TH_MM );
+
+ // Model
+ mpModel = new FmFormModel();
+ mpModel->GetItemPool().FreezeIdRanges();
+
+ // Page
+ mpFmPage = new FmFormPage( *mpModel, NULL );
+ mpModel->InsertPage( mpFmPage, 0 );
+
+ // 3D View
+ mp3DView = new E3dView( mpModel, this );
+ mp3DView->SetBufferedOutputAllowed(true);
+ mp3DView->SetBufferedOverlayAllowed(true);
+
+ // 3D Scene
+ mpScene = new E3dPolyScene(mp3DView->Get3DDefaultAttributes());
+
+ // initially create object
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+
+ // camera and perspective
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(sal_False);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+ mpFmPage->InsertObject( mpScene );
+
+ basegfx::B3DHomMatrix aRotation;
+ aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
+ aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
+ mpScene->SetTransform(aRotation * mpScene->GetTransform());
+
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
+
+ SfxItemSet aSet( mpModel->GetItemPool(),
+ XATTR_LINESTYLE, XATTR_LINESTYLE,
+ XATTR_FILL_FIRST, XATTR_FILLBITMAP,
+ 0, 0 );
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), Color( COL_WHITE ) ) );
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // PageView
+ SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
+ mp3DView->hideMarkHandles();
+
+ // mark scene
+ mp3DView->MarkObj( mpScene, pPageView );
+}
+
+void Svx3DPreviewControl::Resize()
+{
+ // size of page
+ Size aSize( GetSizePixel() );
+ aSize = PixelToLogic( aSize );
+ mpFmPage->SetSize( aSize );
+
+ // set size
+ Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
+ Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
+ (aSize.Height() - aObjSize.Height()) / 2);
+ Rectangle aRect( aObjPoint, aObjSize);
+ mpScene->SetSnapRect( aRect );
+}
+
+void Svx3DPreviewControl::Paint(const Rectangle& rRect)
+{
+ mp3DView->CompleteRedraw(this, Region(rRect));
+}
+
+void Svx3DPreviewControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ Control::MouseButtonDown(rMEvt);
+
+ if( rMEvt.IsShift() && rMEvt.IsMod1() )
+ {
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetObjectType())
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+ }
+}
+
+void Svx3DPreviewControl::SetObjectType(sal_uInt16 nType)
+{
+ if( mnObjectType != nType || !mp3DObj)
+ {
+ SfxItemSet aSet(mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0, 0);
+ mnObjectType = nType;
+
+ if( mp3DObj )
+ {
+ aSet.Put(mp3DObj->GetMergedItemSet());
+ mpScene->Remove3DObj( mp3DObj );
+ delete mp3DObj;
+ mp3DObj = NULL;
+ }
+
+ switch( nType )
+ {
+ case PREVIEW_OBJECTTYPE_SPHERE:
+ {
+ mp3DObj = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( 5000, 5000, 5000 ));
+ }
+ break;
+
+ case PREVIEW_OBJECTTYPE_CUBE:
+ {
+ mp3DObj = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( -2500, -2500, -2500 ),
+ basegfx::B3DVector( 5000, 5000, 5000 ));
+ }
+ break;
+ }
+
+ mpScene->Insert3DObj( mp3DObj );
+ mp3DObj->SetMergedItemSet(aSet);
+
+ Resize();
+ }
+}
+
+SfxItemSet Svx3DPreviewControl::Get3DAttributes() const
+{
+ return mp3DObj->GetMergedItemSet();
+}
+
+void Svx3DPreviewControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ mp3DObj->SetMergedItemSet(rAttr, true);
+ Resize();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
+#define RADIUS_LAMP_SMALL (600.0)
+#define RADIUS_LAMP_BIG (1000.0)
+#define NO_LIGHT_SELECTED (0xffffffff)
+#define MAX_NUMBER_LIGHTS (8)
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, const ResId& rResId)
+: Svx3DPreviewControl(pParent, rResId),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::Svx3DLightControl(Window* pParent, WinBits nStyle)
+: Svx3DPreviewControl(pParent, nStyle),
+ maUserInteractiveChangeCallback(),
+ maUserSelectionChangeCallback(),
+ maChangeCallback(),
+ maSelectionChangeCallback(),
+ maSelectedLight(NO_LIGHT_SELECTED),
+ mpExpansionObject(0),
+ mpLampBottomObject(0),
+ mpLampShaftObject(0),
+ maLightObjects(MAX_NUMBER_LIGHTS, (E3dObject*)0),
+ mfRotateX(-20.0),
+ mfRotateY(45.0),
+ mfRotateZ(0.0),
+ maActionStartPoint(),
+ mnInteractionStartDistance(5 * 5 * 2),
+ mfSaveActionStartHor(0.0),
+ mfSaveActionStartVer(0.0),
+ mfSaveActionStartRotZ(0.0),
+ mbMouseMoved(false),
+ mbGeometrySelected(false)
+{
+ Construct2();
+}
+
+Svx3DLightControl::~Svx3DLightControl()
+{
+ // SdrObjects like mpExpansionObject and mpLampBottomObject/mpLampShaftObject get deleted
+ // with deletion of the DrawingLayer and model
+}
+
+void Svx3DLightControl::Construct2()
+{
+ {
+ // hide all page stuff, use control background (normally gray)
+ const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
+ mp3DView->SetPageVisible(false);
+ mp3DView->SetApplicationBackgroundColor(aDialogColor);
+ mp3DView->SetApplicationDocumentColor(aDialogColor);
+ }
+
+ {
+ // create invisible expansion object
+ const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
+ mpExpansionObject = new E3dCubeObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
+ basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
+ mpScene->Insert3DObj( mpExpansionObject );
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpExpansionObject->SetMergedItemSet(aSet);
+ }
+
+ {
+ // create lamp control object (Yellow lined object)
+ // base circle
+ const basegfx::B2DPolygon a2DCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE));
+ basegfx::B3DPolygon a3DCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DCircle));
+ basegfx::B3DHomMatrix aTransform;
+
+ aTransform.rotate(F_PI2, 0.0, 0.0);
+ aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
+ a3DCircle.transform(aTransform);
+
+ // create object for it
+ mpLampBottomObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DCircle),
+ true);
+ mpScene->Insert3DObj( mpLampBottomObject );
+
+ // half circle with stand
+ basegfx::B2DPolygon a2DHalfCircle;
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0));
+ a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, -RADIUS_LAMP_PREVIEW_SIZE));
+ a2DHalfCircle.append(basegfx::tools::createPolygonFromEllipseSegment(
+ basegfx::B2DPoint(0.0, 0.0), RADIUS_LAMP_PREVIEW_SIZE, RADIUS_LAMP_PREVIEW_SIZE, F_2PI - F_PI2, F_PI2));
+ basegfx::B3DPolygon a3DHalfCircle(basegfx::tools::createB3DPolygonFromB2DPolygon(a2DHalfCircle));
+
+ // create object for it
+ mpLampShaftObject = new E3dPolygonObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPolyPolygon(a3DHalfCircle),
+ true);
+ mpScene->Insert3DObj( mpLampShaftObject );
+
+ // initially invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+ }
+
+ {
+ // change camera settings
+ Camera3D& rCamera = (Camera3D&) mpScene->GetCamera();
+ const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
+ double fW = rVolume.getWidth();
+ double fH = rVolume.getHeight();
+ double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
+
+ rCamera.SetAutoAdjustProjection(sal_False);
+ rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
+ basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ rCamera.SetPosAndLookAt(aCamPos, aLookAt);
+ double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
+ rCamera.SetFocalLength(fDefaultCamFocal);
+ rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, fDefaultCamFocal);
+
+ mpScene->SetCamera( rCamera );
+
+ basegfx::B3DHomMatrix aNeutral;
+ mpScene->SetTransform(aNeutral);
+ }
+
+ // invalidate SnapRects of objects
+ mpScene->SetRectsDirty();
+}
+
+void Svx3DLightControl::ConstructLightObjects()
+{
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ // get rid of evtl. existing light object
+ if(maLightObjects[a])
+ {
+ mpScene->Remove3DObj(maLightObjects[a]);
+ delete maLightObjects[a];
+ maLightObjects[a] = 0;
+ }
+
+ if(GetLightOnOff(a))
+ {
+ const bool bIsSelectedLight(a == maSelectedLight);
+ basegfx::B3DVector aDirection(GetLightDirection(a));
+ aDirection.normalize();
+ aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
+
+ const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
+ E3dObject* pNewLight = new E3dSphereObj(
+ mp3DView->Get3DDefaultAttributes(),
+ basegfx::B3DPoint( 0, 0, 0 ),
+ basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
+ mpScene->Insert3DObj(pNewLight);
+
+ basegfx::B3DHomMatrix aTransform;
+ aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
+ pNewLight->SetTransform(aTransform);
+
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem(String(), GetLightColor(a)));
+ pNewLight->SetMergedItemSet(aSet);
+
+ maLightObjects[a] = pNewLight;
+ }
+ }
+}
+
+void Svx3DLightControl::AdaptToSelectedLight()
+{
+ if(NO_LIGHT_SELECTED == maSelectedLight)
+ {
+ // make mpLampBottomObject/mpLampShaftObject invisible
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+ }
+ else
+ {
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+
+ // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
+ SfxItemSet aSet(mpModel->GetItemPool());
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XLineColorItem(String(), COL_YELLOW));
+ aSet.Put( XLineWidthItem(0));
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+ mpLampBottomObject->SetMergedItemSet(aSet);
+ mpLampShaftObject->SetMergedItemSet(aSet);
+
+ // adapt transformation of mpLampShaftObject
+ basegfx::B3DHomMatrix aTransform;
+ double fRotateY(0.0);
+
+ if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
+ {
+ fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
+ }
+
+ aTransform.rotate(0.0, fRotateY, 0.0);
+ mpLampShaftObject->SetTransform(aTransform);
+
+ // adapt transformation of selected light
+ E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
+
+ if(pSelectedLight)
+ {
+ aTransform.identity();
+ aTransform.translate(
+ aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
+ aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
+ pSelectedLight->SetTransform(aTransform);
+ }
+ }
+}
+
+void Svx3DLightControl::TrySelection(Point aPosPixel)
+{
+ if(mpScene)
+ {
+ const Point aPosLogic(PixelToLogic(aPosPixel));
+ const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
+ std::vector< const E3dCompoundObject* > aResult;
+ getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
+
+ if(aResult.size())
+ {
+ // exclude expansion object which will be part of
+ // the hits. It's invisible, but for HitTest, it's included
+ const E3dCompoundObject* pResult = 0;
+
+ for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++)
+ {
+ if(aResult[b] && aResult[b] != mpExpansionObject)
+ {
+ pResult = aResult[b];
+ }
+ }
+
+ if(pResult == mp3DObj)
+ {
+ if(!mbGeometrySelected)
+ {
+ mbGeometrySelected = true;
+ maSelectedLight = NO_LIGHT_SELECTED;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
+
+ for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
+ {
+ if(maLightObjects[a] && maLightObjects[a] == pResult)
+ {
+ aNewSelectedLight = a;
+ }
+ }
+
+ if(aNewSelectedLight != maSelectedLight)
+ {
+ SelectLight(aNewSelectedLight);
+
+ if(maSelectionChangeCallback.IsSet())
+ {
+ maSelectionChangeCallback.Call(this);
+ }
+ }
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::Paint(const Rectangle& rRect)
+{
+ Svx3DPreviewControl::Paint(rRect);
+}
+
+void Svx3DLightControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ bool bCallParent(true);
+
+ // switch state
+ if(rMEvt.IsLeft())
+ {
+ if(IsSelectionValid() || mbGeometrySelected)
+ {
+ mbMouseMoved = false;
+ bCallParent = false;
+ maActionStartPoint = rMEvt.GetPosPixel();
+ StartTracking();
+ }
+ else
+ {
+ // Einfacher Click ohne viel Bewegen, versuche eine
+ // Selektion
+ TrySelection(rMEvt.GetPosPixel());
+ bCallParent = false;
+ }
+ }
+
+ // call parent
+ if(bCallParent)
+ {
+ Svx3DPreviewControl::MouseButtonDown(rMEvt);
+ }
+}
+
+void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt )
+{
+ if(rTEvt.IsTrackingEnded())
+ {
+ if(rTEvt.IsTrackingCanceled())
+ {
+ if(mbMouseMoved)
+ {
+ // interrupt tracking
+ mbMouseMoved = false;
+
+ if(mbGeometrySelected)
+ {
+ SetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
+ }
+ else
+ {
+ SetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ }
+ else
+ {
+ const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
+
+ if(mbMouseMoved)
+ {
+ // was change dinteractively
+ }
+ else
+ {
+ // simple click without much movement, try selection
+ TrySelection(rMEvt.GetPosPixel());
+ }
+ }
+ }
+ else
+ {
+ const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
+ Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
+
+ if(!mbMouseMoved)
+ {
+ if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > mnInteractionStartDistance)
+ {
+ if(mbGeometrySelected)
+ {
+ GetRotation(mfSaveActionStartVer, mfSaveActionStartHor, mfSaveActionStartRotZ);
+ }
+ else
+ {
+ // intercation start, save values
+ GetPosition(mfSaveActionStartHor, mfSaveActionStartVer);
+ }
+
+ mbMouseMoved = true;
+ }
+ }
+
+ if(mbMouseMoved)
+ {
+ if(mbGeometrySelected)
+ {
+ double fNewRotX = mfSaveActionStartVer - ((double)aDeltaPos.Y() * F_PI180);
+ double fNewRotY = mfSaveActionStartHor + ((double)aDeltaPos.X() * F_PI180);
+
+ // cut horizontal
+ while(fNewRotY < 0.0)
+ {
+ fNewRotY += F_2PI;
+ }
+
+ while(fNewRotY >= F_2PI)
+ {
+ fNewRotY -= F_2PI;
+ }
+
+ // cut vertical
+ if(fNewRotX < -F_PI2)
+ {
+ fNewRotX = -F_PI2;
+ }
+
+ if(fNewRotX > F_PI2)
+ {
+ fNewRotX = F_PI2;
+ }
+
+ SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ else
+ {
+ // interaction in progress
+ double fNewPosHor = mfSaveActionStartHor + ((double)aDeltaPos.X());
+ double fNewPosVer = mfSaveActionStartVer - ((double)aDeltaPos.Y());
+
+ // cut horizontal
+ while(fNewPosHor < 0.0)
+ {
+ fNewPosHor += 360.0;
+ }
+
+ while(fNewPosHor >= 360.0)
+ {
+ fNewPosHor -= 360.0;
+ }
+
+ // cut vertical
+ if(fNewPosVer < -90.0)
+ {
+ fNewPosVer = -90.0;
+ }
+
+ if(fNewPosVer > 90.0)
+ {
+ fNewPosVer = 90.0;
+ }
+
+ SetPosition(fNewPosHor, fNewPosVer);
+
+ if(maChangeCallback.IsSet())
+ {
+ maChangeCallback.Call(this);
+ }
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::Resize()
+{
+ // set size of page
+ const Size aSize(PixelToLogic(GetSizePixel()));
+ mpFmPage->SetSize(aSize);
+
+ // set position and size of scene
+ mpScene->SetSnapRect(Rectangle(Point(0, 0), aSize));
+}
+
+void Svx3DLightControl::SetObjectType(sal_uInt16 nType)
+{
+ // call parent
+ Svx3DPreviewControl::SetObjectType(nType);
+
+ // apply object rotation
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+ }
+}
+
+bool Svx3DLightControl::IsSelectionValid()
+{
+ if((NO_LIGHT_SELECTED != maSelectedLight) && (GetLightOnOff(maSelectedLight)))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
+{
+ if(IsSelectionValid())
+ {
+ basegfx::B3DVector aDirection(GetLightDirection(maSelectedLight));
+ aDirection.normalize();
+ rHor = atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI; // 0..2PI
+ rVer = atan2(aDirection.getY(), aDirection.getXZLength()); // -PI2..PI2
+ rHor /= F_PI180; // 0..360.0
+ rVer /= F_PI180; // -90.0..90.0
+ }
+ if(IsGeometrySelected())
+ {
+ rHor = mfRotateY / F_PI180; // 0..360.0
+ rVer = mfRotateX / F_PI180; // -90.0..90.0
+ }
+}
+
+void Svx3DLightControl::SetPosition(double fHor, double fVer)
+{
+ if(IsSelectionValid())
+ {
+ // set selected light's direction
+ fHor = (fHor * F_PI180) - F_PI; // -PI..PI
+ fVer *= F_PI180; // -PI2..PI2
+ basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
+ aDirection.normalize();
+
+ if(!aDirection.equal(GetLightDirection(maSelectedLight)))
+ {
+ // set changed light direction at SdrScene
+ SfxItemSet aSet(mpModel->GetItemPool());
+
+ switch(maSelectedLight)
+ {
+ case 0: aSet.Put(Svx3DLightDirection1Item(aDirection)); break;
+ case 1: aSet.Put(Svx3DLightDirection2Item(aDirection)); break;
+ case 2: aSet.Put(Svx3DLightDirection3Item(aDirection)); break;
+ case 3: aSet.Put(Svx3DLightDirection4Item(aDirection)); break;
+ case 4: aSet.Put(Svx3DLightDirection5Item(aDirection)); break;
+ case 5: aSet.Put(Svx3DLightDirection6Item(aDirection)); break;
+ case 6: aSet.Put(Svx3DLightDirection7Item(aDirection)); break;
+ default:
+ case 7: aSet.Put(Svx3DLightDirection8Item(aDirection)); break;
+ }
+
+ mpScene->SetMergedItemSet(aSet);
+
+ // correct 3D light's and LampFrame's geometries
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+ }
+ if(IsGeometrySelected())
+ {
+ if(mfRotateX != fVer || mfRotateY != fHor)
+ {
+ mfRotateX = fVer * F_PI180;
+ mfRotateY = fHor * F_PI180;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
+{
+ if(IsGeometrySelected())
+ {
+ if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
+ {
+ mfRotateX = fRotX;
+ mfRotateY = fRotY;
+ mfRotateZ = fRotZ;
+
+ if(mp3DObj)
+ {
+ basegfx::B3DHomMatrix aObjectRotation;
+ aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
+ mp3DObj->SetTransform(aObjectRotation);
+
+ Invalidate();
+ }
+ }
+ }
+}
+
+void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
+{
+ rRotX = mfRotateX;
+ rRotY = mfRotateY;
+ rRotZ = mfRotateZ;
+}
+
+void Svx3DLightControl::Set3DAttributes( const SfxItemSet& rAttr )
+{
+ // call parent
+ Svx3DPreviewControl::Set3DAttributes(rAttr);
+
+ if(maSelectedLight != NO_LIGHT_SELECTED && !GetLightOnOff(maSelectedLight))
+ {
+ // selected light is no more active, select new one
+ maSelectedLight = NO_LIGHT_SELECTED;
+ }
+
+ // local updates
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+}
+
+void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
+{
+ if(nLightNumber > 7)
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+
+ if(NO_LIGHT_SELECTED != nLightNumber)
+ {
+ if(!GetLightOnOff(nLightNumber))
+ {
+ nLightNumber = NO_LIGHT_SELECTED;
+ }
+ }
+
+ if(nLightNumber != maSelectedLight)
+ {
+ maSelectedLight = nLightNumber;
+ mbGeometrySelected = false;
+ ConstructLightObjects();
+ AdaptToSelectedLight();
+ Invalidate();
+ }
+}
+
+bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightOnOff1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue();
+ case 1 : return ((const Svx3DLightOnOff2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue();
+ case 2 : return ((const Svx3DLightOnOff3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue();
+ case 3 : return ((const Svx3DLightOnOff4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue();
+ case 4 : return ((const Svx3DLightOnOff5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue();
+ case 5 : return ((const Svx3DLightOnOff6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue();
+ case 6 : return ((const Svx3DLightOnOff7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue();
+ case 7 : return ((const Svx3DLightOnOff8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue();
+ }
+ }
+
+ return false;
+}
+
+Color Svx3DLightControl::GetLightColor(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightcolor1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
+ case 1 : return ((const Svx3DLightcolor2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
+ case 2 : return ((const Svx3DLightcolor3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
+ case 3 : return ((const Svx3DLightcolor4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
+ case 4 : return ((const Svx3DLightcolor5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
+ case 5 : return ((const Svx3DLightcolor6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
+ case 6 : return ((const Svx3DLightcolor7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
+ case 7 : return ((const Svx3DLightcolor8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
+ }
+ }
+
+ return Color(COL_BLACK);
+}
+
+basegfx::B3DVector Svx3DLightControl::GetLightDirection(sal_uInt32 nNum) const
+{
+ if(nNum <= 7)
+ {
+ const SfxItemSet aLightItemSet(Get3DAttributes());
+
+ switch(nNum)
+ {
+ case 0 : return ((const Svx3DLightDirection1Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue();
+ case 1 : return ((const Svx3DLightDirection2Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue();
+ case 2 : return ((const Svx3DLightDirection3Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue();
+ case 3 : return ((const Svx3DLightDirection4Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue();
+ case 4 : return ((const Svx3DLightDirection5Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue();
+ case 5 : return ((const Svx3DLightDirection6Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue();
+ case 6 : return ((const Svx3DLightDirection7Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue();
+ case 7 : return ((const Svx3DLightDirection8Item&)aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue();
+ }
+ }
+
+ return basegfx::B3DVector();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+SvxLightCtl3D::SvxLightCtl3D( Window* pParent, const ResId& rResId)
+: Control(pParent, rResId),
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
+{
+ // init members
+ Init();
+}
+
+SvxLightCtl3D::SvxLightCtl3D( Window* pParent, WinBits nStyle )
+: Control(pParent, nStyle),
+ maLightControl(this, 0),
+ maHorScroller(this, WB_HORZ | WB_DRAG),
+ maVerScroller(this, WB_VERT | WB_DRAG),
+ maSwitcher(this, 0)
+{
+ // init members
+ Init();
+}
+
+void SvxLightCtl3D::Init()
+{
+ // #i58240# set HelpIDs for scrollbars and switcher
+ maHorScroller.SetHelpId(HID_CTRL3D_HSCROLL);
+ maVerScroller.SetHelpId(HID_CTRL3D_VSCROLL);
+ maSwitcher.SetHelpId(HID_CTRL3D_SWITCHER);
+
+ // Light preview
+ maLightControl.Show();
+ maLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
+ maLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
+
+ // Horiz Scrollbar
+ maHorScroller.Show();
+ maHorScroller.SetRange(Range(0, 36000));
+ maHorScroller.SetLineSize(100);
+ maHorScroller.SetPageSize(1000);
+ maHorScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+
+ // Vert Scrollbar
+ maVerScroller.Show();
+ maVerScroller.SetRange(Range(0, 18000));
+ maVerScroller.SetLineSize(100);
+ maVerScroller.SetPageSize(1000);
+ maVerScroller.SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
+
+ // Switch Button
+ maSwitcher.Show();
+ maSwitcher.SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
+
+ // check selection
+ CheckSelection();
+
+ // new layout
+ NewLayout();
+}
+
+SvxLightCtl3D::~SvxLightCtl3D()
+{
+}
+
+void SvxLightCtl3D::Resize()
+{
+ // call parent
+ Control::Resize();
+
+ // new layout
+ NewLayout();
+}
+
+void SvxLightCtl3D::NewLayout()
+{
+ // Layout members
+ const Size aSize(GetOutputSizePixel());
+ const sal_Int32 nScrollSize(maHorScroller.GetSizePixel().Height());
+
+ // Preview control
+ Point aPoint(0, 0);
+ Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
+ maLightControl.SetPosSizePixel(aPoint, aDestSize);
+
+ // hor scrollbar
+ aPoint.Y() = aSize.Height() - nScrollSize;
+ aDestSize.Height() = nScrollSize;
+ maHorScroller.SetPosSizePixel(aPoint, aDestSize);
+
+ // vert scrollbar
+ aPoint.X() = aSize.Width() - nScrollSize;
+ aPoint.Y() = 0;
+ aDestSize.Width() = nScrollSize;
+ aDestSize.Height() = aSize.Height() - nScrollSize;
+ maVerScroller.SetPosSizePixel(aPoint, aDestSize);
+
+ // button
+ aPoint.Y() = aSize.Height() - nScrollSize;
+ aDestSize.Height() = nScrollSize;
+ maSwitcher.SetPosSizePixel(aPoint, aDestSize);
+}
+
+void SvxLightCtl3D::CheckSelection()
+{
+ const bool bSelectionValid(maLightControl.IsSelectionValid() || maLightControl.IsGeometrySelected());
+ maHorScroller.Enable(bSelectionValid);
+ maVerScroller.Enable(bSelectionValid);
+
+ if(bSelectionValid)
+ {
+ double fHor, fVer;
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+ }
+}
+
+void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
+{
+ double fHor, fVer;
+
+ maLightControl.GetPosition(fHor, fVer);
+ fHor += fDeltaHor;
+ fVer += fDeltaVer;
+
+ if( fVer > 90.0 )
+ return;
+
+ if ( fVer < -90.0 )
+ return;
+
+ maLightControl.SetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+}
+
+void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
+{
+ const KeyCode aCode(rKEvt.GetKeyCode());
+
+ if( aCode.GetModifier() )
+ {
+ Control::KeyInput( rKEvt );
+ return;
+ }
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_SPACE:
+ {
+ break;
+ }
+ case KEY_LEFT:
+ {
+ move( -4.0, 0.0 ); // #i58242# changed move direction in X
+ break;
+ }
+ case KEY_RIGHT:
+ {
+ move( 4.0, 0.0 ); // #i58242# changed move direction in X
+ break;
+ }
+ case KEY_UP:
+ {
+ move( 0.0, 4.0 );
+ break;
+ }
+ case KEY_DOWN:
+ {
+ move( 0.0, -4.0 );
+ break;
+ }
+ case KEY_PAGEUP:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
+
+ if(nLight < 0)
+ {
+ nLight = 7;
+
+ while((nLight >= 0) && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight--;
+ }
+ }
+
+ if(nLight >= 0)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+ }
+
+ break;
+ }
+ case KEY_PAGEDOWN:
+ {
+ sal_Int32 nLight(maLightControl.GetSelectedLight() - 1);
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight++;
+ }
+
+ if(nLight > 7)
+ {
+ nLight = 0;
+
+ while(nLight <= 7 && !maLightControl.GetLightOnOff(nLight))
+ {
+ nLight++;
+ }
+ }
+
+ if(nLight <= 7)
+ {
+ maLightControl.SelectLight(nLight);
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+ }
+
+ break;
+ }
+ default:
+ {
+ Control::KeyInput( rKEvt );
+ break;
+ }
+ }
+}
+
+void SvxLightCtl3D::GetFocus()
+{
+ Control::GetFocus();
+
+ if(HasFocus() && IsEnabled())
+ {
+ CheckSelection();
+
+ Size aFocusSize = maLightControl.GetOutputSizePixel();
+
+ aFocusSize.Width() -= 4;
+ aFocusSize.Height() -= 4;
+
+ Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
+
+ aFocusRect = maLightControl.PixelToLogic( aFocusRect );
+
+ maLightControl.ShowFocus( aFocusRect );
+ }
+}
+
+void SvxLightCtl3D::LoseFocus()
+{
+ Control::LoseFocus();
+
+ maLightControl.HideFocus();
+}
+
+IMPL_LINK( SvxLightCtl3D, ScrollBarMove, void*, EMPTYARG)
+{
+ const sal_Int32 nHor(maHorScroller.GetThumbPos());
+ const sal_Int32 nVer(maVerScroller.GetThumbPos());
+
+ maLightControl.SetPosition(
+ ((double)nHor) / 100.0,
+ ((double)((18000 - nVer) - 9000)) / 100.0);
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, ButtonPress, void*, EMPTYARG)
+{
+ if(PREVIEW_OBJECTTYPE_SPHERE == GetSvx3DLightControl().GetObjectType())
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_CUBE);
+ }
+ else
+ {
+ GetSvx3DLightControl().SetObjectType(PREVIEW_OBJECTTYPE_SPHERE);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, InternalInteractiveChange, void*, EMPTYARG)
+{
+ double fHor, fVer;
+
+ maLightControl.GetPosition(fHor, fVer);
+ maHorScroller.SetThumbPos( sal_Int32(fHor * 100.0) );
+ maVerScroller.SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
+
+ if(maUserInteractiveChangeCallback.IsSet())
+ {
+ maUserInteractiveChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SvxLightCtl3D, InternalSelectionChange, void*, EMPTYARG)
+{
+ CheckSelection();
+
+ if(maUserSelectionChangeCallback.IsSet())
+ {
+ maUserSelectionChangeCallback.Call(this);
+ }
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
new file mode 100644
index 000000000000..7d3d6d05912c
--- /dev/null
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -0,0 +1,2287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _APP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#include <svx/xtable.hxx>
+#include <svx/xpool.hxx>
+
+#include <svx/dialogs.hrc>
+#include "accessibility.hrc"
+#include <svx/dlgctrl.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/poly.hxx>
+#include <vcl/region.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include "svxrectctaccessiblecontext.hxx"
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <svx/svdorect.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
+#include "linectrl.hrc"
+
+#define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
+#define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+
+
+/*************************************************************************
+|*
+|* Control zur Darstellung und Auswahl der Eckpunkte (und Mittelpunkt)
+|* eines Objekts
+|*
+\************************************************************************/
+
+Bitmap& SvxRectCtl::GetRectBitmap( void )
+{
+ if( !pBitmap )
+ InitRectBitmap();
+
+ return *pBitmap;
+}
+
+SvxRectCtl::SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt,
+ sal_uInt16 nBorder, sal_uInt16 nCircle, CTL_STYLE eStyle ) :
+
+ Control( pParent, rResId ),
+
+ pAccContext ( NULL ),
+ nBorderWidth( nBorder ),
+ nRadius ( nCircle),
+ eDefRP ( eRpt ),
+ eCS ( eStyle ),
+ pBitmap ( NULL ),
+ m_nState ( 0 ),
+ mbCompleteDisable(sal_False)
+{
+ SetMapMode( MAP_100TH_MM );
+ Resize_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxRectCtl::~SvxRectCtl()
+{
+ delete pBitmap;
+
+ if( pAccContext )
+ pAccContext->release();
+}
+
+// -----------------------------------------------------------------------
+void SvxRectCtl::Resize()
+{
+ Resize_Impl();
+ Control::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::Resize_Impl()
+{
+ aSize = GetOutputSize();
+
+ switch( eCS )
+ {
+ case CS_RECT:
+ case CS_ANGLE:
+ case CS_SHADOW:
+ aPtLT = Point( 0 + nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( aSize.Width() - nBorderWidth, 0 + nBorderWidth );
+
+ aPtLM = Point( 0 + nBorderWidth, aSize.Height() / 2 );
+ aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
+ aPtRM = Point( aSize.Width() - nBorderWidth, aSize.Height() / 2 );
+
+ aPtLB = Point( 0 + nBorderWidth, aSize.Height() - nBorderWidth );
+ aPtMB = Point( aSize.Width() / 2, aSize.Height() - nBorderWidth );
+ aPtRB = Point( aSize.Width() - nBorderWidth, aSize.Height() - nBorderWidth );
+ break;
+
+ case CS_LINE:
+ aPtLT = Point( 0 + 3 * nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( aSize.Width() - 3 * nBorderWidth, 0 + nBorderWidth );
+
+ aPtLM = Point( 0 + 3 * nBorderWidth, aSize.Height() / 2 );
+ aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
+ aPtRM = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() / 2 );
+
+ aPtLB = Point( 0 + 3 * nBorderWidth, aSize.Height() - nBorderWidth );
+ aPtMB = Point( aSize.Width() / 2, aSize.Height() - nBorderWidth );
+ aPtRB = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() - nBorderWidth );
+ break;
+ }
+ Reset();
+ InitSettings( sal_True, sal_True );
+}
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::InitRectBitmap( void )
+{
+ if( pBitmap )
+ delete pBitmap;
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+
+ pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
+
+ // set bitmap-colors
+ Color aColorAry1[7];
+ Color aColorAry2[7];
+ aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray
+ aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow
+ aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white
+ aColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray
+ aColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black
+ aColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green
+ aColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue
+ aColorAry2[0] = rStyles.GetDialogColor(); // background
+ aColorAry2[1] = rStyles.GetWindowColor();
+ aColorAry2[2] = rStyles.GetLightColor();
+ aColorAry2[3] = rStyles.GetShadowColor();
+ aColorAry2[4] = rStyles.GetDarkShadowColor();
+ aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ aColorAry2[6] = rStyles.GetDialogColor();
+
+#ifdef DBG_UTIL
+ static sal_Bool bModify = sal_False;
+ sal_Bool& rModify = bModify;
+ if( rModify )
+ {
+ static int n = 0;
+ static sal_uInt8 r = 0xFF;
+ static sal_uInt8 g = 0x00;
+ static sal_uInt8 b = 0xFF;
+ int& rn = n;
+ sal_uInt8& rr = r;
+ sal_uInt8& rg = g;
+ sal_uInt8& rb = b;
+ aColorAry2[ rn ] = Color( rr, rg, rb );
+ }
+#endif
+
+ pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if( bForeground )
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+
+ delete pBitmap;
+ pBitmap = NULL; // forces new creating of bitmap
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Das angeklickte Rechteck (3 x 3) wird ermittelt und der Parent (Dialog)
+|* wird benachrichtigt, dass der Punkt geaendert wurde
+|*
+\************************************************************************/
+
+void SvxRectCtl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ Point aPtLast = aPtNew;
+
+ aPtNew = GetApproxLogPtFromPixPt( rMEvt.GetPosPixel() );
+
+ if( aPtNew == aPtMM && ( eCS == CS_SHADOW || eCS == CS_ANGLE ) )
+ {
+ aPtNew = aPtLast;
+ }
+ else
+ {
+ Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ),
+ aPtLast + Point( nRadius, nRadius ) ) );
+ Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ),
+ aPtNew + Point( nRadius, nRadius ) ) );
+ eRP = GetRPFromPoint( aPtNew );
+
+ SetActualRP( eRP );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::KeyInput( const KeyEvent& rKeyEvt )
+{
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ RECT_POINT eNewRP = eRP;
+ sal_Bool bUseMM = (eCS != CS_SHADOW) && (eCS != CS_ANGLE);
+
+ switch( rKeyEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_DOWN:
+ {
+ if( !(m_nState & CS_NOVERT) )
+ switch( eNewRP )
+ {
+ case RP_LT: eNewRP = RP_LM; break;
+ case RP_MT: eNewRP = bUseMM ? RP_MM : RP_MB; break;
+ case RP_RT: eNewRP = RP_RM; break;
+ case RP_LM: eNewRP = RP_LB; break;
+ case RP_MM: eNewRP = RP_MB; break;
+ case RP_RM: eNewRP = RP_RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_UP:
+ {
+ if( !(m_nState & CS_NOVERT) )
+ switch( eNewRP )
+ {
+ case RP_LM: eNewRP = RP_LT; break;
+ case RP_MM: eNewRP = RP_MT; break;
+ case RP_RM: eNewRP = RP_RT; break;
+ case RP_LB: eNewRP = RP_LM; break;
+ case RP_MB: eNewRP = bUseMM ? RP_MM : RP_MT; break;
+ case RP_RB: eNewRP = RP_RM; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_LEFT:
+ {
+ if( !(m_nState & CS_NOHORZ) )
+ switch( eNewRP )
+ {
+ case RP_MT: eNewRP = RP_LT; break;
+ case RP_RT: eNewRP = RP_MT; break;
+ case RP_MM: eNewRP = RP_LM; break;
+ case RP_RM: eNewRP = bUseMM ? RP_MM : RP_LM; break;
+ case RP_MB: eNewRP = RP_LB; break;
+ case RP_RB: eNewRP = RP_MB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_RIGHT:
+ {
+ if( !(m_nState & CS_NOHORZ) )
+ switch( eNewRP )
+ {
+ case RP_LT: eNewRP = RP_MT; break;
+ case RP_MT: eNewRP = RP_RT; break;
+ case RP_LM: eNewRP = bUseMM ? RP_MM : RP_RM; break;
+ case RP_MM: eNewRP = RP_RM; break;
+ case RP_LB: eNewRP = RP_MB; break;
+ case RP_MB: eNewRP = RP_RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ default:
+ Control::KeyInput( rKeyEvt );
+ return;
+ }
+ if( eNewRP != eRP )
+ {
+ SetActualRP( eNewRP );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+
+ SetFocusRect();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRectCtl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das Control (Rechteck mit 9 Kreisen)
+|*
+\************************************************************************/
+
+void SvxRectCtl::Paint( const Rectangle& )
+{
+ Point aPtDiff( PixelToLogic( Point( 1, 1 ) ) );
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+
+ SetLineColor( rStyles.GetDialogColor() );
+ SetFillColor( rStyles.GetDialogColor() );
+ DrawRect( Rectangle( Point(0,0), GetOutputSize() ) );
+
+ if( IsEnabled() )
+ SetLineColor( rStyles.GetLabelTextColor() );
+ else
+ SetLineColor( rStyles.GetShadowColor() );
+
+ SetFillColor();
+
+ switch( eCS )
+ {
+
+ case CS_RECT:
+ case CS_SHADOW:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawRect( Rectangle( aPtLT + aPtDiff, aPtRB + aPtDiff ) );
+ SetLineColor( aOldCol );
+ }
+ DrawRect( Rectangle( aPtLT, aPtRB ) );
+ break;
+
+ case CS_LINE:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawLine( aPtLM - Point( 2 * nBorderWidth, 0) + aPtDiff,
+ aPtRM + Point( 2 * nBorderWidth, 0 ) + aPtDiff );
+ SetLineColor( aOldCol );
+ }
+ DrawLine( aPtLM - Point( 2 * nBorderWidth, 0),
+ aPtRM + Point( 2 * nBorderWidth, 0 ) );
+ break;
+
+ case CS_ANGLE:
+ if( !IsEnabled() )
+ {
+ Color aOldCol = GetLineColor();
+ SetLineColor( rStyles.GetLightColor() );
+ DrawLine( aPtLT + aPtDiff, aPtRB + aPtDiff );
+ DrawLine( aPtLB + aPtDiff, aPtRT + aPtDiff );
+ DrawLine( aPtLM + aPtDiff, aPtRM + aPtDiff );
+ DrawLine( aPtMT + aPtDiff, aPtMB + aPtDiff );
+ SetLineColor( aOldCol );
+ }
+ DrawLine( aPtLT, aPtRB );
+ DrawLine( aPtLB, aPtRT );
+ DrawLine( aPtLM, aPtRM );
+ DrawLine( aPtMT, aPtMB );
+ break;
+
+ default:
+ break;
+ }
+ SetFillColor( GetBackground().GetColor() );
+
+ Size aBtnSize( 11, 11 );
+ Size aDstBtnSize( PixelToLogic( aBtnSize ) );
+ Point aToCenter( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
+ Point aBtnPnt1( IsEnabled()?0:22,0 );
+ Point aBtnPnt2( 11,0 );
+ Point aBtnPnt3( 22,0 );
+
+ sal_Bool bNoHorz = (m_nState & CS_NOHORZ) != 0;
+ sal_Bool bNoVert = (m_nState & CS_NOVERT) != 0;
+
+ Bitmap& rBitmap = GetRectBitmap();
+
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(IsCompletelyDisabled())
+ {
+ DrawBitmap( aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ if( eCS == CS_RECT || eCS == CS_LINE )
+ DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ DrawBitmap( aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
+ }
+ else
+ {
+ DrawBitmap( aPtLT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtRT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ // Mittelpunkt bei Rechteck und Linie
+ if( eCS == CS_RECT || eCS == CS_LINE )
+ DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+
+ DrawBitmap( aPtLB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ DrawBitmap( aPtRB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
+ }
+
+ // draw active button, avoid center pos for angle
+ // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if(!IsCompletelyDisabled())
+ {
+ if( IsEnabled() && (eCS != CS_ANGLE || aPtNew != aPtMM) )
+ {
+ Point aCenterPt( aPtNew );
+ aCenterPt -= aToCenter;
+
+ DrawBitmap( aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Konvertiert RECT_POINT in Point
+|*
+\************************************************************************/
+
+Point SvxRectCtl::GetPointFromRP( RECT_POINT _eRP) const
+{
+ switch( _eRP )
+ {
+ case RP_LT: return aPtLT;
+ case RP_MT: return aPtMT;
+ case RP_RT: return aPtRT;
+ case RP_LM: return aPtLM;
+ case RP_MM: return aPtMM;
+ case RP_RM: return aPtRM;
+ case RP_LB: return aPtLB;
+ case RP_MB: return aPtMB;
+ case RP_RB: return aPtRB;
+ }
+ return( aPtMM ); // default
+}
+
+
+void SvxRectCtl::SetFocusRect( const Rectangle* pRect )
+{
+ HideFocus();
+
+ if( pRect )
+ ShowFocus( *pRect );
+ else
+ ShowFocus( CalculateFocusRectangle() );
+}
+
+Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP )
+{
+ Point aPtLast = aPtNew;
+ aPtNew = GetPointFromRP( eNewRP );
+
+ if( (m_nState & CS_NOHORZ) != 0 )
+ aPtNew.X() = aPtMM.X();
+
+ if( (m_nState & CS_NOVERT) != 0 )
+ aPtNew.Y() = aPtMM.Y();
+
+ eNewRP = GetRPFromPoint( aPtNew );
+
+ eDefRP = eNewRP;
+ eRP = eNewRP;
+
+ return aPtLast;
+}
+
+void SvxRectCtl::GetFocus()
+{
+ SetFocusRect();
+}
+
+
+void SvxRectCtl::LoseFocus()
+{
+ HideFocus();
+}
+
+
+Point SvxRectCtl::GetApproxLogPtFromPixPt( const Point& rPt ) const
+{
+ Point aPt = PixelToLogic( rPt );
+ long x;
+ long y;
+
+ if( ( m_nState & CS_NOHORZ ) == 0 )
+ {
+ if( aPt.X() < aSize.Width() / 3 )
+ x = aPtLT.X();
+ else if( aPt.X() < aSize.Width() * 2 / 3 )
+ x = aPtMM.X();
+ else
+ x = aPtRB.X();
+ }
+ else
+ x = aPtMM.X();
+
+ if( ( m_nState & CS_NOVERT ) == 0 )
+ {
+ if( aPt.Y() < aSize.Height() / 3 )
+ y = aPtLT.Y();
+ else if( aPt.Y() < aSize.Height() * 2 / 3 )
+ y = aPtMM.Y();
+ else
+ y = aPtRB.Y();
+ }
+ else
+ y = aPtMM.Y();
+
+ return Point( x, y );
+}
+
+
+/*************************************************************************
+|*
+|* Konvertiert Point in RECT_POINT
+|*
+\************************************************************************/
+
+RECT_POINT SvxRectCtl::GetRPFromPoint( Point aPt ) const
+{
+ if ( aPt == aPtLT) return RP_LT;
+ else if( aPt == aPtMT) return RP_MT;
+ else if( aPt == aPtRT) return RP_RT;
+ else if( aPt == aPtLM) return RP_LM;
+ else if( aPt == aPtRM) return RP_RM;
+ else if( aPt == aPtLB) return RP_LB;
+ else if( aPt == aPtMB) return RP_MB;
+ else if( aPt == aPtRB) return RP_RB;
+
+ else
+ return RP_MM; // default
+}
+
+/*************************************************************************
+|*
+|* Bewirkt den Ursprungszustand des Controls
+|*
+\************************************************************************/
+
+void SvxRectCtl::Reset()
+{
+ aPtNew = GetPointFromRP( eDefRP );
+ eRP = eDefRP;
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
+|*
+\************************************************************************/
+
+RECT_POINT SvxRectCtl::GetActualRP() const
+{
+ return( eRP );
+}
+
+/*************************************************************************
+|*
+|* Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
+|*
+\************************************************************************/
+
+void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )
+{
+ Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) );
+
+ Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) );
+ Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ), aPtNew + Point( nRadius, nRadius ) ) );
+
+ // notify accessibility object about change
+ if( pAccContext )
+ pAccContext->selectChild( eNewRP );
+}
+
+void SvxRectCtl::SetState( CTL_STATE nState )
+{
+ m_nState = nState;
+
+ Point aPtLast( GetPointFromRP( eRP ) );
+ Point _aPtNew( aPtLast );
+
+ if( (m_nState & CS_NOHORZ) != 0 )
+ _aPtNew.X() = aPtMM.X();
+
+ if( (m_nState & CS_NOVERT) != 0 )
+ _aPtNew.Y() = aPtMM.Y();
+
+ eRP = GetRPFromPoint( _aPtNew );
+ Invalidate();
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
+}
+
+sal_uInt8 SvxRectCtl::GetNumOfChilds( void ) const
+{
+ return ( eCS == CS_ANGLE )? 8 : 9;
+}
+
+Rectangle SvxRectCtl::CalculateFocusRectangle( void ) const
+{
+ Size aDstBtnSize( PixelToLogic( Size( 15, 15 ) ) );
+ return Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
+}
+
+Rectangle SvxRectCtl::CalculateFocusRectangle( RECT_POINT eRectPoint ) const
+{
+ Rectangle aRet;
+ RECT_POINT eOldRectPoint = GetActualRP();
+
+ if( eOldRectPoint == eRectPoint )
+ aRet = CalculateFocusRectangle();
+ else
+ {
+ SvxRectCtl* pThis = const_cast< SvxRectCtl* >( this );
+
+ pThis->SetActualRPWithoutInvalidate( eRectPoint ); // no invalidation because it's only temporary!
+ aRet = CalculateFocusRectangle();
+
+ pThis->SetActualRPWithoutInvalidate( eOldRectPoint ); // no invalidation because nothing has changed!
+ }
+
+ return aRet;
+}
+
+Reference< XAccessible > SvxRectCtl::CreateAccessible()
+{
+ Window* pParent = GetAccessibleParentWindow();
+
+ DBG_ASSERT( pParent, "-SvxRectCtl::CreateAccessible(): No Parent!" );
+
+ Reference< XAccessible > xAccParent = pParent->GetAccessible();
+ if( xAccParent.is() )
+ {
+ pAccContext = new SvxRectCtlAccessibleContext( xAccParent, *this );
+ pAccContext->acquire();
+
+ SetActualRP( GetActualRP() );
+
+ return pAccContext;
+ }
+ else
+ return Reference< XAccessible >();
+}
+
+RECT_POINT SvxRectCtl::GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& r ) const
+{
+ return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
+}
+
+// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
+void SvxRectCtl::DoCompletelyDisable(sal_Bool bNew)
+{
+ mbCompleteDisable = bNew;
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor ohne Size-Parameter
+|*
+\************************************************************************/
+
+SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId ) :
+
+ SvxRectCtl( pParent, rResId ),
+
+ aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
+{
+ aFontSize = Size( 250, 400 );
+ Initialize();
+}
+
+/*************************************************************************
+|*
+|* Konstruktor mit Size-Parameter
+|*
+\************************************************************************/
+
+SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId, Size _aSize ) :
+
+ SvxRectCtl( pParent, rResId ),
+
+ aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
+{
+ aFontSize = _aSize;
+ Initialize();
+}
+
+/*************************************************************************
+|*
+|* Initialisierung
+|*
+\************************************************************************/
+
+void SvxAngleCtl::Initialize()
+{
+ bPositive = sal_True;
+
+ // aFont.SetName( "Helvetica" );
+ aFont.SetSize( aFontSize );
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFont.SetTransparent( sal_False );
+
+ SetFont( aFont );
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das (Mini-)Koordinatensystem
+|*
+\************************************************************************/
+
+void SvxAngleCtl::Paint( const Rectangle& )
+{
+ SetLineColor( Color( COL_BLACK ) ); // PEN_DOT ???
+ DrawLine( aPtLT - Point( 0, 0), aPtRB + Point( 0, 0 ) );
+ DrawLine( aPtLB - Point( 0, 0), aPtRT + Point( 0, 0 ) );
+
+ SetLineColor( Color( COL_BLACK ) );
+ DrawLine( aPtLM - Point( 0, 0), aPtRM + Point( 0, 0 ) );
+ DrawLine( aPtMT - Point( 0, 0), aPtMB + Point( 0, 0 ) );
+
+ Point aDiff(aFontSize.Width() / 2, aFontSize.Height() / 2);
+
+ DrawText( aPtLT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "135" ) ) );
+ DrawText( aPtLM - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "180" ) ) );
+
+ if ( bPositive )
+ DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "225" ) ) );
+ else
+ DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-135" ) ) );
+
+ aDiff.X() = aFontSize.Width();
+ DrawText( aPtMT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "90" ) ) );
+ DrawText( aPtRT - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "45" ) ) );
+ aDiff.X() = aDiff .X() * 3 / 2;
+
+ if ( bPositive )
+ DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "270" ) ) );
+ else
+ DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-90" ) ) );
+
+ DrawText( aPtRM - Point( 0, aDiff.Y() ), UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "0" ) ) );
+ aDiff.X() = aFontSize.Width() * 2;
+
+ if ( bPositive )
+ DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "315" ) ) );
+ else
+ DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "-45" ) ) );
+}
+
+/*************************************************************************
+|*
+|* Control zum Editieren von Bitmaps
+|*
+\************************************************************************/
+
+SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) :
+ Control ( pParent, rResId ),
+ nLines ( nNumber ),
+ bPaintable ( sal_True )
+{
+ // SetMapMode( MAP_100TH_MM );
+ aRectSize = GetOutputSize();
+
+ SetPixelColor( Color( COL_BLACK ) );
+ SetBackgroundColor( Color( COL_WHITE ) );
+ SetLineColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
+
+ nSquares = nLines * nLines;
+ pPixel = new sal_uInt16[ nSquares ];
+ rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
+}
+
+/*************************************************************************
+|*
+|* Destruktor dealociert dyn. Array
+|*
+\************************************************************************/
+
+SvxPixelCtl::~SvxPixelCtl( )
+{
+ delete []pPixel;
+}
+
+/*************************************************************************
+|*
+|* Wechselt die Vordergrund- ,bzw. Hintergrundfarbe
+|*
+\************************************************************************/
+
+void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
+{
+ if( *( pPixel + nPixel) == 0 )
+ *( pPixel + nPixel) = 1; // koennte erweitert werden auf mehrere Farben
+ else
+ *( pPixel + nPixel) = 0;
+}
+
+/*************************************************************************
+|*
+|* Das angeklickte Rechteck wird ermittelt um die Farbe zu wechseln
+|*
+\************************************************************************/
+
+void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
+ Point aPtTl, aPtBr;
+ sal_uInt16 nX, nY;
+
+ nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
+ nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
+
+ ChangePixel( nX + nY * nLines );
+
+ aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
+ aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
+ aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
+ aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
+
+ Invalidate( Rectangle( aPtTl, aPtBr ) );
+
+ if( WINDOW_TABPAGE == GetParent()->GetType() )
+ ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
+}
+
+/*************************************************************************
+|*
+|* Zeichnet das Control (Rechteck mit 9 Kreisen)
+|*
+\************************************************************************/
+
+void SvxPixelCtl::Paint( const Rectangle& )
+{
+ sal_uInt16 i, j, nTmp;
+ Point aPtTl, aPtBr;
+
+ if( bPaintable )
+ {
+ // Linien Zeichnen
+ Control::SetLineColor( aLineColor );
+ for( i = 1; i < nLines; i++)
+ {
+ // horizontal
+ nTmp = (sal_uInt16) ( aRectSize.Height() * i / nLines );
+ DrawLine( Point( 0, nTmp ), Point( aRectSize.Width(), nTmp ) );
+ // vertikal
+ nTmp = (sal_uInt16) ( aRectSize.Width() * i / nLines );
+ DrawLine( Point( nTmp, 0 ), Point( nTmp, aRectSize.Height() ) );
+ }
+
+ // Rechtecke (Quadrate) zeichnen
+ Control::SetLineColor();
+ sal_uInt16 nLastPixel = *pPixel ? 0 : 1;
+
+ for( i = 0; i < nLines; i++)
+ {
+ aPtTl.Y() = aRectSize.Height() * i / nLines + 1;
+ aPtBr.Y() = aRectSize.Height() * (i + 1) / nLines - 1;
+
+ for( j = 0; j < nLines; j++)
+ {
+ aPtTl.X() = aRectSize.Width() * j / nLines + 1;
+ aPtBr.X() = aRectSize.Width() * (j + 1) / nLines - 1;
+
+ if ( *( pPixel + i * nLines + j ) != nLastPixel )
+ {
+ nLastPixel = *( pPixel + i * nLines + j );
+ // Farbe wechseln: 0 -> Hintergrundfarbe
+ SetFillColor( nLastPixel ? aPixelColor : aBackgroundColor );
+ }
+ DrawRect( Rectangle( aPtTl, aPtBr ) );
+ }
+ }
+ } // bPaintable
+ else
+ {
+ SetBackground( Wallpaper( Color( COL_LIGHTGRAY ) ) );
+ Control::SetLineColor( Color( COL_LIGHTRED ) );
+ DrawLine( Point( 0, 0 ), Point( aRectSize.Width(), aRectSize.Height() ) );
+ DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxPixelCtl::SetXBitmap( const XOBitmap& rXBmp )
+{
+ if( rXBmp.GetBitmapType() == XBITMAP_8X8 )
+ {
+ aPixelColor = rXBmp.GetPixelColor();
+ aBackgroundColor = rXBmp.GetBackgroundColor();
+
+ sal_uInt16* pArray = rXBmp.GetPixelArray();
+
+ for( sal_uInt16 i = 0; i < nSquares; i++ )
+ *( pPixel + i ) = *( pArray + i );
+ }
+}
+
+/*************************************************************************
+|*
+|* Gibt ein bestimmtes Pixel zurueck
+|*
+\************************************************************************/
+
+sal_uInt16 SvxPixelCtl::GetBitmapPixel( const sal_uInt16 nPixel )
+{
+ return( *( pPixel + nPixel ) );
+}
+
+/*************************************************************************
+|*
+|* Bewirkt den Ursprungszustand des Controls
+|*
+\************************************************************************/
+
+void SvxPixelCtl::Reset()
+{
+ // clear pixel area
+ rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Ctor: BitmapCtl fuer SvxPixelCtl
+|*
+\************************************************************************/
+
+SvxBitmapCtl::SvxBitmapCtl( Window* /*pParent*/, const Size& rSize )
+{
+ aSize = rSize;
+ // aVD.SetOutputSizePixel( aSize );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxBitmapCtl::~SvxBitmapCtl()
+{
+}
+
+/*************************************************************************
+|*
+|* BitmapCtl: Gibt die Bitmap zurueck
+|*
+\************************************************************************/
+
+XOBitmap SvxBitmapCtl::GetXBitmap()
+{
+ XOBitmap aXOBitmap( pBmpArray, aPixelColor, aBackgroundColor );
+
+ return( aXOBitmap );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox mit Farben und Strings
+|*
+\************************************************************************/
+
+void ColorLB::Fill( const XColorTable* pColorTab )
+{
+ long nCount = pColorTab->Count();
+ XColorEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTab->GetColor( i );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void ColorLB::Append( XColorEntry* pEntry, Bitmap* )
+{
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void ColorLB::Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap* )
+{
+ RemoveEntry( nPos );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName(), nPos );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox mit Farben und Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XColorTable* pColorTab )
+{
+ long nCount = pColorTab->Count();
+ XColorEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pColorTab->GetColor( i );
+ InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+HatchingLB::HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList ( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+HatchingLB::HatchingLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, aWB ),
+ mpList ( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+void HatchingLB::Fill( const XHatchList* pList )
+{
+ mpList = (XHatchList*)pList;
+ XHatchEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetHatch( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void HatchingLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw gradient with borderrectangle
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+
+ sal_uIntPtr nOldDrawMode = pDevice->GetDrawMode();
+ pDevice->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ XHatch& rXHatch = mpList->GetHatch( rUDEvt.GetItemId() )->GetHatch();
+ MapMode aMode( MAP_100TH_MM );
+ Hatch aHatch( (HatchStyle) rXHatch.GetHatchStyle(),
+ rXHatch.GetColor(),
+ rUDEvt.GetDevice()->LogicToPixel( Point( rXHatch.GetDistance(), 0 ), aMode ).X(),
+ (sal_uInt16)rXHatch.GetAngle() );
+ const Polygon aPolygon( aRect );
+ const PolyPolygon aPolypoly( aPolygon );
+ pDevice->DrawHatch( aPolypoly, aHatch );
+
+ pDevice->SetLineColor( COL_BLACK );
+ pDevice->SetFillColor();
+ pDevice->DrawRect( aRect );
+
+ pDevice->SetDrawMode( nOldDrawMode );
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetHatch( rUDEvt.GetItemId() )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void HatchingLB::Append( XHatchEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void HatchingLB::Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void HatchingLB::SelectEntryByList( const XHatchList* pList, const String& rStr,
+ const XHatch& rHatch, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XHatchEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+
+ aStr = pEntry->GetName();
+
+ if( rStr == aStr && rHatch == pEntry->GetHatch() )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XHatchList* pList )
+{
+ long nCount = pList->Count();
+ XHatchEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetHatch( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+GradientLB::GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList(NULL),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw);
+}
+
+GradientLB::GradientLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, aWB ),
+ mpList(NULL),
+ mbUserDraw( bUserDraw )
+{
+ EnableUserDraw( mbUserDraw );
+}
+
+void GradientLB::Fill( const XGradientList* pList )
+{
+ mpList = (XGradientList*)pList;
+ XGradientEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetGradient( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void GradientLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw gradient with borderrectangle
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+
+ XGradient& rXGrad = mpList->GetGradient( rUDEvt.GetItemId() )->GetGradient();
+ Gradient aGradient( (GradientStyle) rXGrad.GetGradientStyle(), rXGrad.GetStartColor(), rXGrad.GetEndColor() );
+ aGradient.SetAngle( (sal_uInt16)rXGrad.GetAngle() );
+ aGradient.SetBorder( rXGrad.GetBorder() );
+ aGradient.SetOfsX( rXGrad.GetXOffset() );
+ aGradient.SetOfsY( rXGrad.GetYOffset() );
+ aGradient.SetStartIntensity( rXGrad.GetStartIntens() );
+ aGradient.SetEndIntensity( rXGrad.GetEndIntens() );
+ aGradient.SetSteps( 255 );
+
+ // #i76307# always paint the preview in LTR, because this is what the document does
+ Window* pWin = dynamic_cast<Window*>(pDevice);
+ if( pWin && pWin->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL())
+ {
+ long nWidth = pDevice->GetOutputSize().Width();
+
+ pWin->EnableRTL( sal_False );
+
+ Rectangle aMirrorRect( Point( nWidth - aRect.Left() - aRect.GetWidth(), aRect.Top() ),
+ aRect.GetSize() );
+
+ pDevice->DrawGradient( aMirrorRect, aGradient );
+
+ pWin->EnableRTL( sal_True );
+ }
+ else
+ pDevice->DrawGradient( aRect, aGradient );
+
+ pDevice->SetLineColor( COL_BLACK );
+ pDevice->SetFillColor();
+ pDevice->DrawRect( aRect );
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetGradient( rUDEvt.GetItemId() )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void GradientLB::Append( XGradientEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void GradientLB::Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void GradientLB::SelectEntryByList( const XGradientList* pList, const String& rStr,
+ const XGradient& rGradient, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XGradientEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+
+ aStr = pEntry->GetName();
+
+ if( rStr == aStr && rGradient == pEntry->GetGradient() )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillAttrLB::Fill( const XGradientList* pList )
+{
+ long nCount = pList->Count();
+ XGradientEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetGradient( i );
+ Bitmap* pBitmap = pList->GetBitmap( i );
+ if( pBitmap )
+ ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor von BitmapLB
+|*
+\************************************************************************/
+
+BitmapLB::BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
+: ListBox( pParent, Id ),
+ mpList( NULL ),
+ mbUserDraw( bUserDraw )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+ EnableUserDraw( mbUserDraw );
+}
+
+/************************************************************************/
+
+void BitmapLB::SetVirtualDevice()
+{
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ }
+}
+
+/************************************************************************/
+
+void BitmapLB::Fill( const XBitmapList* pList )
+{
+ mpList = (XBitmapList*)pList;
+ XBitmapEntry* pEntry;
+ long nCount = pList->Count();
+
+ SetUpdateMode( sal_False );
+
+ if( mbUserDraw )
+ {
+ for( long i = 0; i < nCount; i++ )
+ InsertEntry( pList->GetBitmap( i )->GetName() );
+ }
+ else
+ {
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+
+ SetVirtualDevice();
+
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ }
+
+ SetUpdateMode( sal_True );
+}
+
+void BitmapLB::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if( mpList != NULL )
+ {
+ // Draw bitmap
+ const Rectangle& rDrawRect = rUDEvt.GetRect();
+ Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
+
+ sal_Int32 nId = rUDEvt.GetItemId();
+ if( nId >= 0 && nId <= mpList->Count() )
+ {
+ Rectangle aClipRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nRight-1, rDrawRect.nBottom-1 );
+
+ OutputDevice* pDevice = rUDEvt.GetDevice();
+ pDevice->SetClipRegion( Region( aClipRect ) );
+
+ aBitmap = mpList->GetBitmap( nId )->GetXBitmap().GetBitmap();
+
+ long nPosBaseX = aRect.nLeft;
+ long nPosBaseY = aRect.nTop;
+
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ pDevice->DrawBitmap( Point( nPosBaseX, nPosBaseY ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+0 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+8 ), aBitmap );
+ pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+8 ), aBitmap );
+ }
+
+ pDevice->SetClipRegion();
+
+ // Draw name
+ pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetBitmap( nId )->GetName() );
+ }
+ }
+}
+
+/************************************************************************/
+
+void BitmapLB::Append( XBitmapEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ {
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+ SetVirtualDevice();
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void BitmapLB::Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ {
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+ SetVirtualDevice();
+
+ InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ), nPos );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void BitmapLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& )
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ sal_Bool bFound = sal_False;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+
+ String aStr = pEntry->GetName();
+ // Bitmap aBmp = pEntry->GetBitmap();
+
+ if( rStr == aStr )
+ {
+ bFound = sal_True;
+ }
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 ) );
+}
+
+/*************************************************************************
+|*
+|* Konstruktor von FillAttrLB
+|*
+\************************************************************************/
+
+FillAttrLB::FillAttrLB( Window* pParent, ResId Id ) :
+ ColorListBox( pParent, Id )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+}
+
+/************************************************************************/
+
+FillAttrLB::FillAttrLB( Window* pParent, WinBits aWB ) :
+ ColorListBox( pParent, aWB )
+{
+ aVD.SetOutputSizePixel( Size( 32, 16 ) );
+}
+
+/************************************************************************/
+
+void FillAttrLB::SetVirtualDevice()
+{
+ if( aBitmap.GetSizePixel().Width() > 8 ||
+ aBitmap.GetSizePixel().Height() > 8 )
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
+ }
+ else
+ {
+ aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
+ aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
+ aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
+ }
+}
+
+/************************************************************************/
+
+void FillAttrLB::Fill( const XBitmapList* pList )
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ ListBox::SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+ aBitmap = pEntry->GetXBitmap().GetBitmap();
+
+ SetVirtualDevice();
+
+ ListBox::InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
+ }
+ ListBox::SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void FillAttrLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
+ const Bitmap& /*rBmp*/)
+{
+ long nCount = pList->Count();
+ XBitmapEntry* pEntry;
+ sal_Bool bFound = sal_False;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetBitmap( i );
+
+ String aStr = pEntry->GetName();
+ // Bitmap aBmp = pEntry->GetBitmap();
+
+ if( rStr == aStr )
+ {
+ bFound = sal_True;
+ }
+ /*
+ if( rStr == aStr && rBmp == aBmp )
+ bFound = sal_True; */
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void FillTypeLB::Fill()
+{
+ SetUpdateMode( sal_False );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_INVISIBLE ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_COLOR ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_GRADIENT ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_HATCH ) ) );
+ InsertEntry( String( SVX_RES( RID_SVXSTR_BITMAP ) ) );
+ SetUpdateMode( sal_True );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void LineLB::Fill( const XDashList* pList )
+{
+ long nCount = pList->Count();
+ XDashEntry* pEntry;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetDash( i );
+ Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i );
+ if( pBitmap )
+ {
+ InsertEntry( pEntry->GetName(), *pBitmap );
+ delete pBitmap;
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+void LineLB::FillStyles()
+{
+ ResMgr& rMgr = DIALOG_MGR();
+
+ // Linienstile
+ Clear();
+ InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) );
+ Color aSourceColors[2];
+ Color aDestColors[2];
+
+ aSourceColors[0] = Color( COL_WHITE );
+ aSourceColors[1] = Color( COL_BLACK );
+
+ aDestColors[0] = rStyles.GetFieldColor();
+ aDestColors[1] = rStyles.GetFieldTextColor();
+
+ aBitmap.Replace ( aSourceColors, aDestColors, 2 );
+ Image aSolidLine ( aBitmap );
+ InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine );
+}
+
+/************************************************************************/
+
+void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp )
+{
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp );
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ InsertEntry( pEntry->GetName(), *pBmp, nPos );
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+/************************************************************************/
+
+void LineLB::SelectEntryByList( const XDashList* pList, const String& rStr,
+ const XDash& rDash, sal_uInt16 nDist )
+{
+ long nCount = pList->Count();
+ XDashEntry* pEntry;
+ sal_Bool bFound = sal_False;
+ String aStr;
+ XDash aDash;
+
+ long i;
+ for( i = 0; i < nCount && !bFound; i++ )
+ {
+ pEntry = pList->GetDash( i );
+
+ aStr = pEntry->GetName();
+ aDash = pEntry->GetDash();
+
+ if( rStr == aStr && rDash == aDash )
+ bFound = sal_True;
+ }
+ if( bFound )
+ SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
+}
+
+/*************************************************************************
+|*
+|* Fuellt die Listbox (vorlaeufig) mit Strings
+|*
+\************************************************************************/
+
+void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart )
+{
+ long nCount = pList->Count();
+ XLineEndEntry* pEntry;
+ VirtualDevice aVD;
+ SetUpdateMode( sal_False );
+
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = pList->GetLineEnd( i );
+ Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i );
+ if( pBitmap )
+ {
+ Size aBmpSize( pBitmap->GetSizePixel() );
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBitmap );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
+
+ delete pBitmap;
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+ }
+ SetUpdateMode( sal_True );
+}
+
+/************************************************************************/
+
+void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp,
+ sal_Bool bStart )
+{
+ if( pBmp )
+ {
+ VirtualDevice aVD;
+ Size aBmpSize( pBmp->GetSizePixel() );
+
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBmp );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
+ }
+ else
+ InsertEntry( pEntry->GetName() );
+}
+
+/************************************************************************/
+
+void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp,
+ sal_Bool bStart )
+{
+ RemoveEntry( nPos );
+
+ if( pBmp )
+ {
+ VirtualDevice aVD;
+ Size aBmpSize( pBmp->GetSizePixel() );
+
+ aVD.SetOutputSizePixel( aBmpSize, sal_False );
+ aVD.DrawBitmap( Point(), *pBmp );
+ InsertEntry( pEntry->GetName(),
+ aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
+ Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ), nPos );
+ }
+ else
+ InsertEntry( pEntry->GetName(), nPos );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if(bForeground)
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+
+ if(IsControlForeground())
+ {
+ aTextColor = GetControlForeground();
+ }
+
+ getBufferDevice().SetTextColor(aTextColor);
+ }
+
+ if(bBackground)
+ {
+ if(IsControlBackground())
+ {
+ getBufferDevice().SetBackground(GetControlBackground());
+ }
+ else
+ {
+ getBufferDevice().SetBackground(rStyleSettings.GetWindowColor());
+ }
+ }
+
+ // do not paint background self, it gets painted buffered
+ SetControlBackground();
+ SetBackground();
+
+ Invalidate();
+}
+
+SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId )
+: Control( pParent, rResId ),
+ mpModel( new SdrModel() ),
+ mpBufferDevice( new VirtualDevice(*this) )
+{
+ // Draw the control's border as a flat thin black line.
+ SetBorderStyle(WINDOW_BORDER_MONO);
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ SetMapMode(MAP_100TH_MM);
+
+ // init model
+ mpModel->GetItemPool().FreezeIdRanges();
+}
+
+SvxPreviewBase::~SvxPreviewBase()
+{
+ delete mpModel;
+ delete mpBufferDevice;
+}
+
+void SvxPreviewBase::LocalPrePaint()
+{
+ // init BufferDevice
+ if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
+ {
+ mpBufferDevice->SetDrawMode(GetDrawMode());
+ mpBufferDevice->SetSettings(GetSettings());
+ mpBufferDevice->SetAntialiasing(GetAntialiasing());
+ mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
+ mpBufferDevice->SetMapMode(GetMapMode());
+ }
+
+ mpBufferDevice->Erase();
+}
+
+void SvxPreviewBase::LocalPostPaint()
+{
+ // copy to front (in pixel mode)
+ const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled());
+ const bool bWasEnabledDst(IsMapModeEnabled());
+ const Point aEmptyPoint;
+
+ mpBufferDevice->EnableMapMode(false);
+ EnableMapMode(false);
+
+ DrawOutDev(
+ aEmptyPoint, GetOutputSizePixel(),
+ aEmptyPoint, GetOutputSizePixel(),
+ *mpBufferDevice);
+
+ mpBufferDevice->EnableMapMode(bWasEnabledSrc);
+ EnableMapMode(bWasEnabledDst);
+}
+
+void SvxPreviewBase::StateChanged(StateChangedType nType)
+{
+ Control::StateChanged(nType);
+
+ if(STATE_CHANGE_CONTROLFOREGROUND == nType)
+ {
+ InitSettings(true, false);
+ }
+ else if(STATE_CHANGE_CONTROLBACKGROUND == nType)
+ {
+ InitSettings(false, true);
+ }
+}
+
+void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt)
+{
+ SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
+
+ if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
+ {
+ InitSettings(true, true);
+ }
+ else
+ {
+ Control::DataChanged(rDCEvt);
+ }
+}
+
+/*************************************************************************
+|*
+|* SvxXLinePreview::SvxXLinePreview()
+|*
+*************************************************************************/
+
+SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpLineObjA( 0L ),
+ mpLineObjB( 0L ),
+ mpLineObjC( 0L ),
+ mpGraphic( 0L ),
+ mbWithSymbol( sal_False )
+{
+ const Size aOutputSize(GetOutputSize());
+ InitSettings( sal_True, sal_True );
+
+ const sal_Int32 nDistance(500L);
+ const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));
+
+ // create DrawObectA
+ const sal_Int32 aYPosA(aOutputSize.Height() / 2);
+ const basegfx::B2DPoint aPointA1( nDistance, aYPosA);
+ const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
+ basegfx::B2DPolygon aPolygonA;
+ aPolygonA.append(aPointA1);
+ aPolygonA.append(aPointA2);
+ mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA));
+ mpLineObjA->SetModel(&getModel());
+
+ // create DrawObectB
+ const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
+ const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
+ const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance, aYPosB1);
+ const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
+ const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
+ basegfx::B2DPolygon aPolygonB;
+ aPolygonB.append(aPointB1);
+ aPolygonB.append(aPointB2);
+ aPolygonB.append(aPointB3);
+ mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB));
+ mpLineObjB->SetModel(&getModel());
+
+ // create DrawObectC
+ const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1);
+ const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
+ const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
+ basegfx::B2DPolygon aPolygonC;
+ aPolygonC.append(aPointC1);
+ aPolygonC.append(aPointC2);
+ aPolygonC.append(aPointC3);
+ mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC));
+ mpLineObjC->SetModel(&getModel());
+}
+
+SvxXLinePreview::~SvxXLinePreview()
+{
+ SdrObject::Free( mpLineObjA );
+ SdrObject::Free( mpLineObjB );
+ SdrObject::Free( mpLineObjC );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::SetSymbol(Graphic* p,const Size& s)
+{
+ mpGraphic = p;
+ maSymbolSize = s;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::ResizeSymbol(const Size& s)
+{
+ if ( s != maSymbolSize )
+ {
+ maSymbolSize = s;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet)
+{
+ // Set ItemSet at objects
+ mpLineObjA->SetMergedItemSet(rItemSet);
+
+ // At line joints, do not use arrows
+ SfxItemSet aTempSet(rItemSet);
+ aTempSet.ClearItem(XATTR_LINESTART);
+ aTempSet.ClearItem(XATTR_LINEEND);
+
+ mpLineObjB->SetMergedItemSet(aTempSet);
+ mpLineObjC->SetMergedItemSet(aTempSet);
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXLinePreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ // paint objects to buffer device
+ sdr::contact::SdrObjectVector aObjectVector;
+ aObjectVector.push_back(mpLineObjA);
+ aObjectVector.push_back(mpLineObjB);
+ aObjectVector.push_back(mpLineObjC);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ if ( mbWithSymbol && mpGraphic )
+ {
+ const Size aOutputSize(GetOutputSize());
+ Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
+ aPos.X() -= maSymbolSize.Width() / 2;
+ aPos.Y() -= maSymbolSize.Height() / 2;
+ mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize );
+ }
+
+ LocalPostPaint();
+}
+
+/*************************************************************************
+|*
+|* SvxXRectPreview::SvxXRectPreview()
+|*
+*************************************************************************/
+
+SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpRectangleObject(0)
+{
+ InitSettings(true, true);
+
+ // create RectangleObject
+ const Rectangle aObjectSize(Point(), GetOutputSize());
+ mpRectangleObject = new SdrRectObj(aObjectSize);
+ mpRectangleObject->SetModel(&getModel());
+}
+
+SvxXRectPreview::~SvxXRectPreview()
+{
+ SdrObject::Free(mpRectangleObject);
+}
+
+void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleObject->SetMergedItemSet(rItemSet, true);
+ mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXRectPreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ aObjectVector.push_back(mpRectangleObject);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ LocalPostPaint();
+}
+
+/*************************************************************************
+|*
+|* SvxXShadowPreview::SvxXShadowPreview()
+|*
+*************************************************************************/
+
+SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId )
+: SvxPreviewBase( pParent, rResId ),
+ mpRectangleObject(0),
+ mpRectangleShadow(0)
+{
+ InitSettings(true, true);
+
+ // prepare size
+ Size aSize = GetOutputSize();
+ aSize.Width() = aSize.Width() / 3;
+ aSize.Height() = aSize.Height() / 3;
+
+ // create RectangleObject
+ const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
+ mpRectangleObject = new SdrRectObj(aObjectSize);
+ mpRectangleObject->SetModel(&getModel());
+
+ // create ShadowObject
+ const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
+ mpRectangleShadow = new SdrRectObj(aShadowSize);
+ mpRectangleShadow->SetModel(&getModel());
+}
+
+SvxXShadowPreview::~SvxXShadowPreview()
+{
+ SdrObject::Free(mpRectangleObject);
+ SdrObject::Free(mpRectangleShadow);
+}
+
+void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleObject->SetMergedItemSet(rItemSet, true);
+ mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXShadowPreview::SetShadowAttributes(const SfxItemSet& rItemSet)
+{
+ mpRectangleShadow->SetMergedItemSet(rItemSet, true);
+ mpRectangleShadow->SetMergedItem(XLineStyleItem(XLINE_NONE));
+}
+
+void SvxXShadowPreview::SetShadowPosition(const Point& rPos)
+{
+ Rectangle aObjectPosition(mpRectangleObject->GetSnapRect());
+ aObjectPosition.Move(rPos.X(), rPos.Y());
+ mpRectangleShadow->SetSnapRect(aObjectPosition);
+}
+
+void SvxXShadowPreview::Paint( const Rectangle& )
+{
+ LocalPrePaint();
+
+ sdr::contact::SdrObjectVector aObjectVector;
+
+ aObjectVector.push_back(mpRectangleShadow);
+ aObjectVector.push_back(mpRectangleObject);
+
+ sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ aPainter.ProcessDisplay(aDisplayInfo);
+
+ LocalPostPaint();
+}
+
+// -----------------------------------------------------------------------
+// eof
diff --git a/svx/source/dialog/dlgctrl.src b/svx/source/dialog/dlgctrl.src
new file mode 100644
index 000000000000..2da544673c65
--- /dev/null
+++ b/svx/source/dialog/dlgctrl.src
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+Bitmap RID_SVXCTRL_RECTBTNS
+{
+ File = "rectbtns.bmp" ;
+};
+
diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx
new file mode 100644
index 000000000000..44a9762a023a
--- /dev/null
+++ b/svx/source/dialog/dlgutil.cxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "svx/dlgutil.hxx"
+#include <svl/itemset.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/module.hxx>
+#include <svl/intitem.hxx>
+
+// -----------------------------------------------------------------------
+
+FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
+{
+ FieldUnit eUnit = FUNIT_INCH;
+ const SfxPoolItem* pItem = NULL;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC, sal_False, &pItem ) )
+ eUnit = (FieldUnit)( (const SfxUInt16Item*)pItem )->GetValue();
+ else
+ {
+ DBG_ERROR("Using fallback for field unit - field unit should be provided in ItemSet");
+ return SfxModule::GetCurrentFieldUnit();
+ }
+
+ return eUnit;
+}
+
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
new file mode 100644
index 000000000000..da320eea50d7
--- /dev/null
+++ b/svx/source/dialog/docrecovery.cxx
@@ -0,0 +1,2181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+
+#include <svx/dialogs.hrc>
+#include "docrecovery.hxx"
+#include "docrecovery.hrc"
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/configurationhelper.hxx>
+#include <svtools/imagemgr.hxx>
+#include <svtools/xtextedt.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/scrbar.hxx>
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+
+//#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+//#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <osl/file.hxx>
+#include <osl/security.hxx>
+#include <rtl/bootstrap.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/localfilehelper.hxx>
+
+#define RET_BACK 100
+
+//===============================================
+// namespace
+namespace svx{
+ namespace DocRecovery{
+
+namespace css = ::com::sun::star;
+
+using namespace ::rtl;
+using namespace ::osl;
+
+//===============================================
+TabDialog4Recovery::TabDialog4Recovery(Window* pParent)
+ : TabDialog (pParent, SVX_RES( RID_SVX_TABDLG_DOCRECOVERY ))
+ , m_pActualPage(m_lTabPages.begin() )
+{
+}
+
+//===============================================
+TabDialog4Recovery::~TabDialog4Recovery()
+{
+ m_lTabPages.clear();
+}
+
+//===============================================
+void TabDialog4Recovery::addTabPage(IExtendedTabPage* pPage)
+{
+ if (pPage)
+ m_lTabPages.push_back(pPage);
+}
+
+//===============================================
+short TabDialog4Recovery::Execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ Show();
+ m_pActualPage = m_lTabPages.begin();
+ while(sal_True)
+ {
+ IExtendedTabPage* pPage = *m_pActualPage;
+ SetViewWindow(pPage);
+ pPage->Show();
+ pPage->setDefButton();
+ short nRet = pPage->execute();
+ pPage->Hide();
+
+ switch(nRet)
+ {
+ case DLG_RET_OK :
+ {
+ ++m_pActualPage;
+ if (m_pActualPage == m_lTabPages.end())
+ return nRet;
+ }
+ break;
+
+ case DLG_RET_BACK :
+ {
+ if (m_pActualPage != m_lTabPages.begin())
+ --m_pActualPage;
+ }
+ break;
+
+ case DLG_RET_UNKNOWN :
+ case DLG_RET_CANCEL :
+ case DLG_RET_OK_AUTOLUNCH :
+ return nRet;
+ }
+ }
+}
+
+//===============================================
+RecoveryCore::RecoveryCore(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ sal_Bool bUsedForSaving)
+ : m_xSMGR ( xSMGR )
+ , m_pListener ( 0 )
+ , m_bListenForSaving(bUsedForSaving)
+{
+ impl_startListening();
+}
+
+//===============================================
+RecoveryCore::~RecoveryCore()
+{
+ impl_stopListening();
+}
+
+//===============================================
+css::uno::Reference< css::lang::XMultiServiceFactory > RecoveryCore::getSMGR()
+{
+ return m_xSMGR;
+}
+
+//===============================================
+TURLList* RecoveryCore::getURLListAccess()
+{
+ return &m_lURLs;
+}
+
+//===============================================
+sal_Bool RecoveryCore::existsBrokenTempEntries()
+{
+ TURLList::const_iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (RecoveryCore::isBrokenTempEntry(rInfo))
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//===============================================
+sal_Bool RecoveryCore::existsNonRecoveredEntries()
+{
+ TURLList::const_iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (rInfo.RecoveryState == E_NOT_RECOVERED_YET)
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//===============================================
+sal_Bool RecoveryCore::isBrokenTempEntry(const TURLInfo& rInfo)
+{
+ if (!rInfo.TempURL.getLength())
+ return sal_False;
+
+ // Note: If the original files was recovery ... but a temp file
+ // exists ... an error inside the temp file exists!
+ if (
+ !(rInfo.RecoveryState == E_RECOVERY_FAILED ) &&
+ !(rInfo.RecoveryState == E_ORIGINAL_DOCUMENT_RECOVERED)
+ )
+ return sal_False;
+
+ return sal_True;
+}
+
+//===============================================
+void RecoveryCore::saveBrokenTempEntries(const ::rtl::OUString& sPath)
+{
+ if (!sPath.getLength())
+ return;
+
+ if (!m_xRealCore.is())
+ return;
+
+ // prepare all needed parameters for the following dispatch() request.
+ css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP);
+ css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3);
+ lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lCopyArgs[0].Value <<= sal_False;
+ lCopyArgs[1].Name = PROP_SAVEPATH;
+ lCopyArgs[1].Value <<= sPath;
+ lCopyArgs[2].Name = PROP_ENTRYID;
+ // lCopyArgs[2].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lCopyArgs[2].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aCopyURL, lCopyArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::saveAllTempEntries(const ::rtl::OUString& sPath)
+{
+ if (!sPath.getLength())
+ return;
+
+ if (!m_xRealCore.is())
+ return;
+
+ // prepare all needed parameters for the following dispatch() request.
+ css::util::URL aCopyURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_BACKUP);
+ css::uno::Sequence< css::beans::PropertyValue > lCopyArgs(3);
+ lCopyArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lCopyArgs[0].Value <<= sal_False;
+ lCopyArgs[1].Name = PROP_SAVEPATH;
+ lCopyArgs[1].Value <<= sPath;
+ lCopyArgs[2].Name = PROP_ENTRYID;
+ // lCopyArgs[2].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!rInfo.TempURL.getLength())
+ continue;
+
+ lCopyArgs[2].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aCopyURL, lCopyArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetBrokenTempEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetAllRecoveryEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::forgetBrokenRecoveryEntries()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aRemoveURL = impl_getParsedURL(RECOVERY_CMD_DO_ENTRY_CLEANUP);
+ css::uno::Sequence< css::beans::PropertyValue > lRemoveArgs(2);
+ lRemoveArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lRemoveArgs[0].Value <<= sal_False;
+ lRemoveArgs[1].Name = PROP_ENTRYID;
+ // lRemoveArgs[1].Value will be changed during next loop ...
+
+ // work on a copied list only ...
+ // Reason: We will get notifications from the core for every
+ // changed or removed element. And that will change our m_lURLs list.
+ // That's not a good idea, if we use a stl iterator inbetween .-)
+ TURLList lURLs = m_lURLs;
+ TURLList::const_iterator pIt;
+ for ( pIt = lURLs.begin();
+ pIt != lURLs.end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+
+ lRemoveArgs[1].Value <<= rInfo.ID;
+ m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
+ }
+}
+
+//===============================================
+void RecoveryCore::setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress)
+{
+ m_xProgress = xProgress;
+}
+
+//===============================================
+void RecoveryCore::setUpdateListener(IRecoveryUpdateListener* pListener)
+{
+ m_pListener = pListener;
+}
+
+//===============================================
+void RecoveryCore::doEmergencySavePrepare()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(1);
+ lArgs[0].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[0].Value <<= sal_False;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+void RecoveryCore::doEmergencySave()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_EMERGENCY_SAVE);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = PROP_STATUSINDICATOR;
+ lArgs[0].Value <<= m_xProgress;
+ lArgs[1].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[1].Value <<= sal_True;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+void RecoveryCore::doRecovery()
+{
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL = impl_getParsedURL(RECOVERY_CMD_DO_RECOVERY);
+
+ css::uno::Sequence< css::beans::PropertyValue > lArgs(2);
+ lArgs[0].Name = PROP_STATUSINDICATOR;
+ lArgs[0].Value <<= m_xProgress;
+ lArgs[1].Name = PROP_DISPATCHASYNCHRON;
+ lArgs[1].Value <<= sal_True;
+
+ m_xRealCore->dispatch(aURL, lArgs);
+}
+
+//===============================================
+ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState)
+{
+ // ???
+ ERecoveryState eRecState = E_NOT_RECOVERED_YET;
+
+ /* Attention:
+ Some of the following states can occure at the
+ same time. So we have to check for the "worst case" first!
+
+ DAMAGED -> INCOMPLETE -> HANDLED
+ */
+
+ // running ...
+ if (
+ ((eDocState & E_TRY_LOAD_BACKUP ) == E_TRY_LOAD_BACKUP ) ||
+ ((eDocState & E_TRY_LOAD_ORIGINAL) == E_TRY_LOAD_ORIGINAL)
+ )
+ eRecState = E_RECOVERY_IS_IN_PROGRESS;
+ // red
+ else
+ if ((eDocState & E_DAMAGED) == E_DAMAGED)
+ eRecState = E_RECOVERY_FAILED;
+ // yellow
+ else
+ if ((eDocState & E_INCOMPLETE) == E_INCOMPLETE)
+ eRecState = E_ORIGINAL_DOCUMENT_RECOVERED;
+ // green
+ else
+ if ((eDocState & E_SUCCEDED) == E_SUCCEDED)
+ eRecState = E_SUCCESSFULLY_RECOVERED;
+
+ return eRecState;
+}
+
+//===============================================
+void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& aEvent)
+ throw(css::uno::RuntimeException)
+{
+ // a) special notification about start/stop async dispatch!
+ // FeatureDescriptor = "start" || "stop"
+ if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_START))
+ {
+ if (m_pListener)
+ m_pListener->start();
+ return;
+ }
+
+ if (aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_STOP))
+ {
+ if (m_pListener)
+ m_pListener->end();
+ return;
+ }
+
+ // b) normal notification about changed items
+ // FeatureDescriptor = "Update"
+ // State = Lits of informations [seq< NamedValue >]
+ if (! aEvent.FeatureDescriptor.equals(RECOVERY_OPERATIONSTATE_UPDATE))
+ return;
+
+ ::comphelper::SequenceAsHashMap lInfo(aEvent.State);
+ TURLInfo aNew;
+
+ aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 );
+ aNew.DocState = lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 );
+ aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , ::rtl::OUString());
+ aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , ::rtl::OUString());
+ aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , ::rtl::OUString());
+ aNew.TemplateURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPLATEURL, ::rtl::OUString());
+ aNew.DisplayName = lInfo.getUnpackedValueOrDefault(STATEPROP_TITLE , ::rtl::OUString());
+ aNew.Module = lInfo.getUnpackedValueOrDefault(STATEPROP_MODULE , ::rtl::OUString());
+
+ // search for already existing items and update her nState value ...
+ TURLList::iterator pIt;
+ for ( pIt = m_lURLs.begin();
+ pIt != m_lURLs.end() ;
+ ++pIt )
+ {
+ TURLInfo& aOld = *pIt;
+ if (aOld.ID == aNew.ID)
+ {
+ // change existing
+ aOld.DocState = aNew.DocState;
+ aOld.RecoveryState = RecoveryCore::mapDocState2RecoverState(aOld.DocState);
+ if (m_pListener)
+ {
+ m_pListener->updateItems();
+ m_pListener->stepNext(&aOld);
+ }
+ return;
+ }
+ }
+
+ // append as new one
+ // TODO think about mmatching Module name to a corresponding icon
+ String sURL = aNew.OrgURL;
+ if (!sURL.Len())
+ sURL = aNew.FactoryURL;
+ if (!sURL.Len())
+ sURL = aNew.TempURL;
+ if (!sURL.Len())
+ sURL = aNew.TemplateURL;
+ INetURLObject aURL(sURL);
+ aNew.StandardImage = SvFileInformationManager::GetFileImage(aURL, false, false);
+ aNew.HCImage = SvFileInformationManager::GetFileImage(aURL, false, true );
+
+ /* set the right UI state for this item to NOT_RECOVERED_YET ... because nDocState shows the state of
+ the last emergency save operation before and is interessting for the used recovery core service only ...
+ for now! But if there is a further notification for this item (see lines above!) we must
+ map the doc state to an UI state. */
+ aNew.RecoveryState = E_NOT_RECOVERED_YET;
+
+ // patch DisplayName! Because the document title contain more then the file name ...
+ sal_Int32 i = aNew.DisplayName.indexOf(::rtl::OUString::createFromAscii(" - "));
+ if (i > 0)
+ aNew.DisplayName = aNew.DisplayName.copy(0, i);
+
+ m_lURLs.push_back(aNew);
+
+ if (m_pListener)
+ m_pListener->updateItems();
+}
+
+//===============================================
+void SAL_CALL RecoveryCore::disposing(const css::lang::EventObject& /*aEvent*/)
+ throw(css::uno::RuntimeException)
+{
+ m_xRealCore.clear();
+}
+
+//===============================================
+void RecoveryCore::impl_startListening()
+{
+ // listening already initialized ?
+ if (m_xRealCore.is())
+ return;
+ m_xRealCore = css::uno::Reference< css::frame::XDispatch >(m_xSMGR->createInstance(SERVICENAME_RECOVERYCORE), css::uno::UNO_QUERY_THROW);
+
+ css::util::URL aURL;
+ if (m_bListenForSaving)
+ aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE;
+ else
+ aURL.Complete = RECOVERY_CMD_DO_RECOVERY;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ /* Note: addStatusListener() call us synchronous back ... so we
+ will get the complete list of currently open documents! */
+ m_xRealCore->addStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL);
+}
+
+//===============================================
+void RecoveryCore::impl_stopListening()
+{
+ // Ignore it, if this instance doesnt listen currently
+ if (!m_xRealCore.is())
+ return;
+
+ css::util::URL aURL;
+ if (m_bListenForSaving)
+ aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE;
+ else
+ aURL.Complete = RECOVERY_CMD_DO_RECOVERY;
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ m_xRealCore->removeStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL);
+ m_xRealCore.clear();
+}
+
+//===============================================
+css::util::URL RecoveryCore::impl_getParsedURL(const ::rtl::OUString& sURL)
+{
+ css::util::URL aURL;
+ aURL.Complete = sURL;
+
+ css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW);
+ xParser->parseStrict(aURL);
+
+ return aURL;
+}
+
+//===============================================
+PluginProgressWindow::PluginProgressWindow( Window* pParent ,
+ const css::uno::Reference< css::lang::XComponent >& xProgress)
+ : Window (pParent )
+ , m_xProgress(xProgress)
+{
+ Show();
+ Size aParentSize = pParent->GetSizePixel();
+ // align the progressbar to its parent
+ SetPosSizePixel( -9, 0, aParentSize.Width() + 15, aParentSize.Height() - 4 );
+}
+
+//===============================================
+PluginProgressWindow::~PluginProgressWindow()
+{
+ if (m_xProgress.is())
+ m_xProgress->dispose();
+}
+
+//===============================================
+PluginProgress::PluginProgress( Window* pParent,
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+{
+ m_pPlugProgressWindow = new PluginProgressWindow(pParent, static_cast< css::lang::XComponent* >(this));
+ css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow);
+ m_xProgressFactory = css::uno::Reference< css::task::XStatusIndicatorFactory >(xSMGR->createInstance(SERVICENAME_PROGRESSFACTORY), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XInitialization > xInit(m_xProgressFactory, css::uno::UNO_QUERY_THROW);
+
+ css::uno::Sequence< css::uno::Any > lArgs(2);
+ css::beans::NamedValue aProp;
+ aProp.Name = PROP_PARENTWINDOW;
+ aProp.Value <<= xProgressWindow;
+ lArgs[0] <<= aProp;
+ aProp.Name = PROP_ALLOWPARENTSHOW;
+ aProp.Value <<= sal_True;
+ lArgs[1] <<= aProp;
+
+ xInit->initialize(lArgs);
+
+ m_xProgress = m_xProgressFactory->createStatusIndicator();
+}
+
+//===============================================
+PluginProgress::~PluginProgress()
+{
+}
+
+//===============================================
+Window* PluginProgress::getPlugWindow()
+{
+ return m_pPlugProgressWindow;
+}
+
+//===============================================
+void SAL_CALL PluginProgress::dispose()
+ throw(css::uno::RuntimeException)
+{
+ // m_pPluginProgressWindow was deleted ...
+ // So the internal pointer of this progress
+ // weill be dead!
+ m_xProgress.clear();
+}
+
+//===============================================
+void SAL_CALL PluginProgress::addEventListener(const css::uno::Reference< css::lang::XEventListener >& )
+ throw(css::uno::RuntimeException)
+{
+}
+
+//===============================================
+void SAL_CALL PluginProgress::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& )
+ throw(css::uno::RuntimeException)
+{
+}
+
+//===============================================
+void SAL_CALL PluginProgress::start(const ::rtl::OUString&,
+ sal_Int32 nRange)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->start(::rtl::OUString(), nRange);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::end()
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->end();
+}
+
+//===============================================
+void SAL_CALL PluginProgress::setText(const ::rtl::OUString& sText)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->setText(sText);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::setValue(sal_Int32 nValue)
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->setValue(nValue);
+}
+
+//===============================================
+void SAL_CALL PluginProgress::reset()
+ throw(css::uno::RuntimeException)
+{
+ if (m_xProgress.is())
+ m_xProgress->reset();
+}
+
+//===============================================
+SaveDialog::SaveDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) )
+ , m_aTitleWin ( this , SVX_RES ( WIN_SAVE_TITLE ) )
+ , m_aTitleFT ( this , SVX_RES ( FT_SAVE_TITLE ) )
+ , m_aTitleFL ( this , SVX_RES ( FL_SAVE_TITLE ) )
+ , m_aDescrFT ( this , SVX_RES ( FT_SAVE_DESCR ) )
+ , m_aFileListFT ( this , SVX_RES ( FT_SAVE_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES ( LB_SAVE_FILELIST ) )
+ , m_aBottomFL ( this , SVX_RES ( FL_SAVE_BOTTOM ) )
+ , m_aOkBtn ( this , SVX_RES ( BT_SAVE_OK ) )
+ , m_pCore ( pCore )
+{
+ FreeResource();
+
+ // Prepare the office for the following crash save step.
+ // E.g. hide all open widows so the user cant influence our
+ // operation .-)
+ m_pCore->doEmergencySavePrepare();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Wallpaper aBackground(rStyleSettings.GetWindowColor());
+ m_aTitleWin.SetBackground(aBackground);
+ m_aTitleFT.SetBackground (aBackground);
+
+ Font aFont(m_aTitleFT.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ m_aTitleFT.SetFont(aFont);
+
+ m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) );
+// m_aFileListLB.EnableInput( sal_False );
+ m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() );
+
+ // fill listbox with current open documents
+ m_aFileListLB.Clear();
+
+ TURLList* pURLs = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+
+ for ( pIt = pURLs->begin();
+ pIt != pURLs->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+ m_aFileListLB.InsertEntry( rInfo.DisplayName, rInfo.StandardImage );
+ }
+}
+
+//===============================================
+SaveDialog::~SaveDialog()
+{
+}
+
+//===============================================
+IMPL_LINK( SaveDialog, OKButtonHdl, void*, EMPTYARG )
+{
+ m_nResult = DLG_RET_OK;
+ return 0;
+}
+
+//===============================================
+short SaveDialog::execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ // wait for user input "OK"
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+
+ // start crash-save with progress
+ if (m_nResult == DLG_RET_OK)
+ {
+ SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore);
+ m_nResult = pProgress->Execute();
+ delete pProgress;
+ }
+ // if "CANCEL" => return "CANCEL"
+ // if "OK" => "AUTOLUNCH" always !
+ if (m_nResult == DLG_RET_OK)
+ m_nResult = DLG_RET_OK_AUTOLUNCH;
+
+ return m_nResult;
+}
+
+//===============================================
+void SaveDialog::setDefButton()
+{
+ m_aOkBtn.GrabFocus();
+}
+
+//===============================================
+SaveProgressDialog::SaveProgressDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) )
+ , m_aHintFT ( this , SVX_RES ( FT_SAVEPROGR_HINT ) )
+ , m_aProgrFT ( this , SVX_RES ( FT_SAVEPROGR_PROGR ) )
+ , m_aProgrParent( this , SVX_RES ( WIN_SAVEPROGR_PROGR ) )
+ , m_pCore ( pCore )
+{
+ FreeResource();
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() );
+ m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
+// m_aProgrBaseTxt = m_aProgrFT.GetText();
+}
+
+//===============================================
+SaveProgressDialog::~SaveProgressDialog()
+{
+}
+
+//===============================================
+short SaveProgressDialog::Execute()
+{
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+
+ m_pCore->setProgressHandler(m_xProgress);
+ m_pCore->setUpdateListener(this);
+ m_pCore->doEmergencySave();
+ short nRet = ModalDialog::Execute();
+ m_pCore->setUpdateListener(0);
+ return nRet;
+}
+
+//===============================================
+void SaveProgressDialog::updateItems()
+{
+}
+
+//===============================================
+void SaveProgressDialog::stepNext(TURLInfo* )
+{
+ /* TODO
+
+ wenn die m_pCore noch ein Member m_nCurrentItem haette
+ koennte man dort erkennen, wer gerade drann war, wer demnaechst
+ dran ist ... Diese Info kann man dann in unserem Progress FixText anzeigen ...
+ */
+}
+
+//===============================================
+void SaveProgressDialog::start()
+{
+}
+
+//===============================================
+void SaveProgressDialog::end()
+{
+ EndDialog(DLG_RET_OK);
+}
+
+//===============================================
+RecovDocListEntry::RecovDocListEntry( SvLBoxEntry* pEntry,
+ sal_uInt16 nFlags,
+ const String& sText )
+ : SvLBoxString( pEntry, nFlags, sText )
+{
+}
+
+//===============================================
+void RecovDocListEntry::Paint(const Point& aPos ,
+ SvLBox& aDevice,
+ sal_uInt16 /*nFlags */,
+ SvLBoxEntry* pEntry )
+{
+ const Image* pImg = 0;
+ const String* pTxt = 0;
+ RecovDocList* pList = static_cast< RecovDocList* >(&aDevice);
+
+ sal_Bool bHC = aDevice.GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ switch(pInfo->RecoveryState)
+ {
+ case E_SUCCESSFULLY_RECOVERED :
+ {
+ pImg = &pList->m_aGreenCheckImg;
+ if (bHC)
+ pImg = &pList->m_aGreenCheckImgHC;
+ pTxt = &pList->m_aSuccessRecovStr;
+ }
+ break;
+
+ case E_ORIGINAL_DOCUMENT_RECOVERED : // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow
+ {
+ pImg = &pList->m_aYellowCheckImg;
+ if (bHC)
+ pImg = &pList->m_aYellowCheckImgHC;
+ pTxt = &pList->m_aOrigDocRecovStr;
+ }
+ break;
+
+ case E_RECOVERY_FAILED :
+ {
+ pImg = &pList->m_aRedCrossImg;
+ if (bHC)
+ pImg = &pList->m_aRedCrossImgHC;
+ pTxt = &pList->m_aRecovFailedStr;
+ }
+ break;
+
+ case E_RECOVERY_IS_IN_PROGRESS :
+ {
+ pImg = 0;
+ pTxt = &pList->m_aRecovInProgrStr;
+ }
+ break;
+
+ case E_NOT_RECOVERED_YET :
+ {
+ pImg = 0;
+ pTxt = &pList->m_aNotRecovYetStr;
+ }
+ break;
+ }
+
+ if (pImg)
+ aDevice.DrawImage(aPos, *pImg);
+
+ if (pTxt)
+ {
+ ::rtl::OUString sT1(*pTxt);
+
+ Point aPnt(aPos);
+ aPnt.X() += pList->m_aGreenCheckImg.GetSizePixel().Width();
+ aPnt.X() += 10;
+ aDevice.DrawText(aPnt, *pTxt);
+ }
+}
+//===============================================
+RecovDocList::RecovDocList( Window* pParent,
+ const ResId& rResId )
+ : SvxSimpleTable ( pParent, rResId )
+ , m_aGreenCheckImg ( ResId(IMG_GREENCHECK,*rResId.GetResMgr() ) )
+ , m_aYellowCheckImg ( ResId(IMG_YELLOWCHECK,*rResId.GetResMgr() ) )
+ , m_aRedCrossImg ( ResId(IMG_REDCROSS,*rResId.GetResMgr() ) )
+ , m_aGreenCheckImgHC ( ResId(IMG_GREENCHECK_HC,*rResId.GetResMgr() ) )
+ , m_aYellowCheckImgHC ( ResId(IMG_YELLOWCHECK_HC,*rResId.GetResMgr() ) )
+ , m_aRedCrossImgHC ( ResId(IMG_REDCROSS_HC,*rResId.GetResMgr() ) )
+ , m_aSuccessRecovStr ( ResId(STR_SUCCESSRECOV,*rResId.GetResMgr() ) )
+ , m_aOrigDocRecovStr ( ResId(STR_ORIGDOCRECOV,*rResId.GetResMgr() ) )
+ , m_aRecovFailedStr ( ResId(STR_RECOVFAILED,*rResId.GetResMgr() ) )
+ , m_aRecovInProgrStr ( ResId(STR_RECOVINPROGR,*rResId.GetResMgr() ) )
+ , m_aNotRecovYetStr ( ResId(STR_NOTRECOVYET,*rResId.GetResMgr() ) )
+{
+ //SetEntryHeight( short( maGreenCheckImg.GetSizePixel().Height() ) );
+}
+
+//===============================================
+RecovDocList::~RecovDocList()
+{
+}
+
+//===============================================
+void RecovDocList::InitEntry( SvLBoxEntry* pEntry ,
+ const XubString& sText ,
+ const Image& aImage1,
+ const Image& aImage2,
+ SvLBoxButtonKind eButtonKind)
+{
+ SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind);
+ DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" );
+
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem(2);
+ RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, pCol->GetText());
+ pEntry->ReplaceItem(p, 2);
+}
+
+//===============================================
+short impl_askUserForWizardCancel(Window* pParent, sal_Int16 nRes)
+{
+ QueryBox aQuery(pParent, SVX_RES(nRes));
+ if (aQuery.Execute() == RET_YES)
+ return DLG_RET_OK;
+ else
+ return DLG_RET_CANCEL;
+}
+
+//===============================================
+RecoveryDialog::RecoveryDialog(Window* pParent,
+ RecoveryCore* pCore )
+ : IExtendedTabPage( pParent , SVX_RES( RID_SVXPAGE_DOCRECOVERY_RECOVER ) )
+ , m_aTitleWin ( this , SVX_RES ( WIN_RECOV_TITLE ) )
+ , m_aTitleFT ( this , SVX_RES ( FT_RECOV_TITLE ) )
+ , m_aTitleFL ( this , SVX_RES ( FL_RECOV_TITLE ) )
+ , m_aDescrFT ( this , SVX_RES ( FT_RECOV_DESCR ) )
+ , m_aProgressFT ( this , SVX_RES ( FT_RECOV_PROGR ) )
+ , m_aProgrParent ( this , SVX_RES ( WIN_RECOV_PROGR ) )
+ , m_aFileListFT ( this , SVX_RES ( FT_RECOV_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES ( LB_RECOV_FILELIST ) )
+ , m_aBottomFL ( this , SVX_RES ( FL_RECOV_BOTTOM ) )
+ , m_aNextBtn ( this , SVX_RES ( BTN_RECOV_NEXT ) )
+ , m_aCancelBtn ( this , SVX_RES ( BTN_RECOV_CANCEL ) )
+ , m_aNextStr ( SVX_RES ( STR_RECOVERY_NEXT ) )
+ , m_aTitleRecoveryInProgress( SVX_RES ( STR_RECOVERY_INPROGRESS ) )
+ , m_aTitleRecoveryReport( SVX_RES ( STR_RECOVERY_REPORT ) )
+ , m_aRecoveryOnlyFinish ( SVX_RES ( STR_RECOVERYONLY_FINISH ) )
+ , m_aRecoveryOnlyFinishDescr( SVX_RES ( STR_RECOVERYONLY_FINISH_DESCR ) )
+ , m_pDefButton ( NULL )
+ , m_pCore ( pCore )
+ , m_eRecoveryState (RecoveryDialog::E_RECOVERY_PREPARED)
+ , m_bWaitForUser (sal_False)
+ , m_bWaitForCore (sal_False)
+ , m_bUserDecideNext (sal_False)
+ , m_bWasRecoveryStarted (sal_False)
+ , m_bRecoveryOnly (sal_False)
+{
+ static long nTabs[] = { 2, 0, 40*RECOV_CONTROLWIDTH/100 };
+ m_aFileListLB.SetTabs( &nTabs[0] );
+ m_aFileListLB.InsertHeaderEntry( String( SVX_RES( STR_HEADERBAR ) ) );
+
+ FreeResource();
+
+ ::rtl::OUString CFG_PACKAGE_RECOVERY( RTL_CONSTASCII_USTRINGPARAM ( "org.openoffice.Office.Recovery/" ));
+ ::rtl::OUString CFG_PATH_CRASHREPORTER( RTL_CONSTASCII_USTRINGPARAM( "CrashReporter" ));
+ ::rtl::OUString CFG_ENTRY_ENABLED( RTL_CONSTASCII_USTRINGPARAM ( "Enabled" ));
+
+ sal_Bool bCrashRepEnabled( sal_True );
+ css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+ pCore->getSMGR(),
+ CFG_PACKAGE_RECOVERY,
+ CFG_PATH_CRASHREPORTER,
+ CFG_ENTRY_ENABLED,
+ ::comphelper::ConfigurationHelper::E_READONLY);
+ aVal >>= bCrashRepEnabled;
+ m_bRecoveryOnly = !bCrashRepEnabled;
+
+ PluginProgress* pProgress = new PluginProgress( &m_aProgrParent, pCore->getSMGR() );
+ m_xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Wallpaper aBackground( rStyleSettings.GetWindowColor() );
+ m_aTitleWin.SetBackground(aBackground);
+ m_aTitleFT.SetBackground (aBackground);
+
+ Font aFont(m_aTitleFT.GetFont());
+ aFont.SetWeight(WEIGHT_BOLD);
+ m_aTitleFT.SetFont(aFont);
+
+ m_aFileListLB.SetBackground( rStyleSettings.GetDialogColor() );
+
+ m_aNextBtn.Enable(sal_True);
+ m_aNextBtn.SetClickHdl( LINK( this, RecoveryDialog, NextButtonHdl ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, RecoveryDialog, CancelButtonHdl ) );
+
+ // fill list box first time
+ TURLList* pURLList = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+ for ( pIt = pURLList->begin();
+ pIt != pURLList->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+
+ String sName( rInfo.DisplayName );
+ sName += '\t';
+ sName += impl_getStatusString( rInfo );
+ SvLBoxEntry* pEntry = m_aFileListLB.InsertEntry(sName, rInfo.StandardImage, rInfo.StandardImage);
+ pEntry->SetUserData((void*)&rInfo);
+ m_aFileListLB.SetExpandedEntryBmp (pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST);
+ m_aFileListLB.SetCollapsedEntryBmp(pEntry, rInfo.HCImage, BMP_COLOR_HIGHCONTRAST);
+ }
+
+ // mark first item
+ SvLBoxEntry* pFirst = m_aFileListLB.First();
+ if (pFirst)
+ m_aFileListLB.SetCursor(pFirst, sal_True);
+}
+
+//===============================================
+RecoveryDialog::~RecoveryDialog()
+{
+}
+
+//===============================================
+short RecoveryDialog::execute()
+{
+ ::vos::OGuard aSolarLock(Application::GetSolarMutex());
+
+ switch(m_eRecoveryState)
+ {
+ case RecoveryDialog::E_RECOVERY_PREPARED :
+ {
+ // Dialog was started first time ...
+ // wait for user decision ("start" or "cancel" recovery)
+ // This decision will be made inside the NextBtn handler.
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_True);
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+ if (m_bUserDecideNext)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_IN_PROGRESS;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_IN_PROGRESS :
+ {
+ // user decided to start recovery ...
+ m_bWasRecoveryStarted = sal_True;
+ // do it asynchronous (to allow repaints)
+ // and wait for this asynchronous operation.
+ m_aDescrFT.SetText( m_aTitleRecoveryInProgress );
+ m_aNextBtn.Enable(sal_False);
+ m_aCancelBtn.Enable(sal_False);
+ m_pCore->setProgressHandler(m_xProgress);
+ m_pCore->setUpdateListener(this);
+ m_pCore->doRecovery();
+
+ m_bWaitForCore = sal_True;
+ while(m_bWaitForCore)
+ Application::Yield();
+
+ m_pCore->setUpdateListener(0);
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CORE_DONE;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_CORE_DONE :
+ {
+ // the core finished it's task.
+ // let the user decide the next step.
+ if ( m_bRecoveryOnly )
+ {
+ m_aDescrFT.SetText(m_aRecoveryOnlyFinishDescr);
+ m_aNextBtn.SetText(m_aRecoveryOnlyFinish);
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_False);
+ }
+ else
+ {
+ m_aDescrFT.SetText(m_aTitleRecoveryReport);
+ m_aNextBtn.SetText(m_aNextStr);
+ m_aNextBtn.Enable(sal_True);
+ m_aCancelBtn.Enable(sal_True);
+ }
+
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+
+ if (m_bUserDecideNext)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_DONE;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_DONE :
+ {
+ // All documents was reovered.
+ // User decided to step to the "next" wizard page.
+ // Do it ... but check first, if there exist some
+ // failed recovery documents. They must be saved to
+ // a user selected directrory.
+ short nRet = DLG_RET_UNKNOWN;
+ BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
+ String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default dir
+ if (pBrokenRecoveryDialog->isExecutionNeeded())
+ {
+ nRet = pBrokenRecoveryDialog->Execute();
+ sSaveDir = pBrokenRecoveryDialog->getSaveDirURL();
+ }
+ delete pBrokenRecoveryDialog;
+
+ switch(nRet)
+ {
+ // no broken temp files exists
+ // step to the next wizard page
+ case DLG_RET_UNKNOWN :
+ {
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ // user decided to save the broken temp files
+ // do and forget it
+ // step to the next wizard page
+ case DLG_RET_OK :
+ {
+ m_pCore->saveBrokenTempEntries(sSaveDir);
+ m_pCore->forgetBrokenTempEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ // user decided to ignore broken temp files.
+ // Ask it again ... may be this decision was wrong.
+ // Results:
+ // IGNORE => remove broken temp files
+ // => step to the next wizard page
+ // CANCEL => step back to the recovery page
+ case DLG_RET_CANCEL :
+ {
+ // TODO ask user ...
+ m_pCore->forgetBrokenTempEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+ }
+
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+ return DLG_RET_OK;
+ }
+
+ case RecoveryDialog::E_RECOVERY_CANCELED :
+ {
+ // "YES" => break recovery
+ // But there exist different states, where "cancel" can be called.
+ // Handle it different.
+ if (m_bWasRecoveryStarted)
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS;
+ else
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED_BEFORE;
+ return execute();
+ }
+
+ case RecoveryDialog::E_RECOVERY_CANCELED_BEFORE :
+ case RecoveryDialog::E_RECOVERY_CANCELED_AFTERWARDS :
+ {
+ // We have to check if there exists some temp. files.
+ // They should be saved to a user defined location.
+ // If no temp files exists or user decided to ignore it ...
+ // we have to remove all recovery/session data anyway!
+ short nRet = DLG_RET_UNKNOWN;
+ BrokenRecoveryDialog* pBrokenRecoveryDialog = new BrokenRecoveryDialog(this, m_pCore, !m_bWasRecoveryStarted);
+ String sSaveDir = pBrokenRecoveryDialog->getSaveDirURL(); // get the default save location
+
+ // dialog itself checks if there is a need to copy files for this mode.
+ // It uses the information m_bWasRecoveryStarted doing so.
+ if (pBrokenRecoveryDialog->isExecutionNeeded())
+ {
+ nRet = pBrokenRecoveryDialog->Execute();
+ sSaveDir = pBrokenRecoveryDialog->getSaveDirURL();
+ }
+ delete pBrokenRecoveryDialog;
+
+ // Possible states:
+ // a) nRet == DLG_RET_UNKNOWN
+ // dialog was not shown ...
+ // because there exists no temp file for copy.
+ // => remove all recovery data
+ // b) nRet == DLG_RET_OK
+ // dialog was shown ...
+ // user decided to save temp files
+ // => save all OR broken temp files (depends from the time, where cancel was called)
+ // => remove all recovery data
+ // c) nRet == DLG_RET_CANCEL
+ // dialog was shown ...
+ // user decided to ignore temp files
+ // => remove all recovery data
+ // => a)/c) are the same ... b) has one additional operation
+
+ // b)
+ if (nRet == DLG_RET_OK)
+ {
+ if (m_bWasRecoveryStarted)
+ m_pCore->saveBrokenTempEntries(sSaveDir);
+ else
+ m_pCore->saveAllTempEntries(sSaveDir);
+ }
+
+ // a,b,c)
+ if (m_bWasRecoveryStarted)
+ m_pCore->forgetBrokenRecoveryEntries();
+ else
+ m_pCore->forgetAllRecoveryEntries();
+ m_eRecoveryState = RecoveryDialog::E_RECOVERY_HANDLED;
+
+ // THERE IS NO WAY BACK. see impl_askUserForWizardCancel()!
+ return DLG_RET_CANCEL;
+ }
+
+ case RecoveryDialog::E_RECOVERY_HANDLED :
+ {
+ m_bWaitForUser = sal_True;
+ while(m_bWaitForUser)
+ Application::Yield();
+
+ // TODO: show BrokenRecoveryDialog again, ift he user
+ // doesnt accepted it last time.
+
+ if (m_bUserDecideNext)
+ return DLG_RET_OK;
+ else
+ return DLG_RET_CANCEL;
+ }
+ }
+
+ // should never be reached .-)
+ DBG_ERROR("Should never be reached!");
+ return DLG_RET_OK;
+}
+
+//===============================================
+void RecoveryDialog::setDefButton()
+{
+ if ( m_aNextBtn.IsEnabled() )
+ m_aNextBtn.GrabFocus();
+ else
+ m_pDefButton = &m_aNextBtn;
+}
+
+//===============================================
+void RecoveryDialog::start()
+{
+}
+
+//===============================================
+void RecoveryDialog::updateItems()
+{
+ sal_uIntPtr c = m_aFileListLB.GetEntryCount();
+ sal_uIntPtr i = 0;
+ for ( i=0; i<c; ++i )
+ {
+ SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i);
+ if ( !pEntry )
+ continue;
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ if ( !pInfo )
+ continue;
+
+ String sStatus = impl_getStatusString( *pInfo );
+ if ( sStatus.Len() > 0 )
+ m_aFileListLB.SetEntryText( sStatus, pEntry, 1 );
+ }
+
+ m_aFileListLB.Invalidate();
+ m_aFileListLB.Update();
+}
+
+//===============================================
+void RecoveryDialog::stepNext(TURLInfo* pItem)
+{
+ sal_uIntPtr c = m_aFileListLB.GetEntryCount();
+ sal_uIntPtr i = 0;
+ for (i=0; i<c; ++i)
+ {
+ SvLBoxEntry* pEntry = m_aFileListLB.GetEntry(i);
+ if (!pEntry)
+ continue;
+
+ TURLInfo* pInfo = (TURLInfo*)pEntry->GetUserData();
+ if (pInfo->ID != pItem->ID)
+ continue;
+
+ m_aFileListLB.SetCursor(pEntry, sal_True);
+ m_aFileListLB.MakeVisible(pEntry);
+ m_aFileListLB.Invalidate();
+ m_aFileListLB.Update();
+ break;
+ }
+}
+
+//===============================================
+void RecoveryDialog::end()
+{
+ if ( m_pDefButton )
+ {
+ m_pDefButton->GrabFocus();
+ m_pDefButton = NULL;
+ }
+ m_bWaitForCore = sal_False;
+}
+
+//===============================================
+IMPL_LINK( RecoveryDialog, NextButtonHdl, void*, EMPTYARG )
+{
+ m_bUserDecideNext = sal_True;
+ m_bWaitForUser = sal_False;
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( RecoveryDialog, CancelButtonHdl, void*, EMPTYARG )
+{
+ if (m_eRecoveryState == RecoveryDialog::E_RECOVERY_PREPARED)
+ {
+ if (impl_askUserForWizardCancel(this, RID_SVXQB_EXIT_RECOVERY) == DLG_RET_CANCEL)
+ return 0;
+ }
+ m_bUserDecideNext = sal_False;
+ m_bWaitForUser = sal_False;
+ return 0;
+}
+
+//===============================================
+void RecoveryDialog::impl_refreshDocList()
+{
+}
+
+//===============================================
+String RecoveryDialog::impl_getStatusString( const TURLInfo& rInfo ) const
+{
+ String sStatus;
+ switch ( rInfo.RecoveryState )
+ {
+ case E_SUCCESSFULLY_RECOVERED :
+ sStatus = m_aFileListLB.m_aSuccessRecovStr;
+ break;
+ case E_ORIGINAL_DOCUMENT_RECOVERED :
+ sStatus = m_aFileListLB.m_aOrigDocRecovStr;
+ break;
+ case E_RECOVERY_FAILED :
+ sStatus = m_aFileListLB.m_aRecovFailedStr;
+ break;
+ case E_RECOVERY_IS_IN_PROGRESS :
+ sStatus = m_aFileListLB.m_aRecovInProgrStr;
+ break;
+ case E_NOT_RECOVERED_YET :
+ sStatus = m_aFileListLB.m_aNotRecovYetStr;
+ break;
+ default:
+ break;
+ }
+ return sStatus;
+}
+
+//===============================================
+BrokenRecoveryDialog::BrokenRecoveryDialog(Window* pParent ,
+ RecoveryCore* pCore ,
+ sal_Bool bBeforeRecovery)
+ : ModalDialog ( pParent, SVX_RES( RID_SVX_MDLG_DOCRECOVERY_BROKEN ) )
+ , m_aDescrFT ( this , SVX_RES( FT_BROKEN_DESCR ) )
+ , m_aFileListFT ( this , SVX_RES( FT_BROKEN_FILELIST ) )
+ , m_aFileListLB ( this , SVX_RES( LB_BROKEN_FILELIST ) )
+ , m_aSaveDirFT ( this , SVX_RES( FT_BROKEN_SAVEDIR ) )
+ , m_aSaveDirED ( this , SVX_RES( ED_BROKEN_SAVEDIR ) )
+ , m_aSaveDirBtn ( this , SVX_RES( BTN_BROKEN_SAVEDIR ) )
+ , m_aBottomFL ( this , SVX_RES( FL_BROKEN_BOTTOM ) )
+ , m_aOkBtn ( this , SVX_RES( BTN_BROKEN_OK ) )
+ , m_aCancelBtn ( this , SVX_RES( BTN_BROKEN_CANCEL ) )
+ , m_pCore ( pCore )
+ , m_bBeforeRecovery (bBeforeRecovery)
+ , m_bExecutionNeeded(sal_False)
+{
+ FreeResource();
+
+ m_aSaveDirBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, SaveButtonHdl ) );
+ m_aOkBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, OkButtonHdl ) );
+ m_aCancelBtn.SetClickHdl( LINK( this, BrokenRecoveryDialog, CancelButtonHdl ) );
+
+ m_sSavePath = SvtPathOptions().GetWorkPath();
+ INetURLObject aObj( m_sSavePath );
+ String sPath;
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( aObj.GetMainURL( INetURLObject::NO_DECODE ), sPath );
+ m_aSaveDirED.SetText( sPath );
+
+ impl_refresh();
+}
+
+//===============================================
+BrokenRecoveryDialog::~BrokenRecoveryDialog()
+{
+}
+
+//===============================================
+void BrokenRecoveryDialog::impl_refresh()
+{
+ m_bExecutionNeeded = sal_False;
+ TURLList* pURLList = m_pCore->getURLListAccess();
+ TURLList::const_iterator pIt;
+ for ( pIt = pURLList->begin();
+ pIt != pURLList->end() ;
+ ++pIt )
+ {
+ const TURLInfo& rInfo = *pIt;
+
+ if (m_bBeforeRecovery)
+ {
+ // "Cancel" before recovery ->
+ // search for any temp files!
+ if (!rInfo.TempURL.getLength())
+ continue;
+ }
+ else
+ {
+ // "Cancel" after recovery ->
+ // search for broken temp files
+ if (!RecoveryCore::isBrokenTempEntry(rInfo))
+ continue;
+ }
+
+ m_bExecutionNeeded = sal_True;
+
+ sal_uInt16 nPos = m_aFileListLB.InsertEntry(rInfo.DisplayName, rInfo.StandardImage );
+ m_aFileListLB.SetEntryData( nPos, (void*)&rInfo );
+ }
+ m_sSavePath = ::rtl::OUString();
+ m_aOkBtn.GrabFocus();
+}
+
+//===============================================
+sal_Bool BrokenRecoveryDialog::isExecutionNeeded()
+{
+ return m_bExecutionNeeded;
+}
+
+//===============================================
+::rtl::OUString BrokenRecoveryDialog::getSaveDirURL()
+{
+ return m_sSavePath;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, OkButtonHdl, void*, EMPTYARG )
+{
+ String sPhysicalPath = m_aSaveDirED.GetText().EraseLeadingChars().EraseTrailingChars();
+ String sURL;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPhysicalPath, sURL );
+ m_sSavePath = sURL;
+ while (!m_sSavePath.getLength())
+ impl_askForSavePath();
+
+ EndDialog(DLG_RET_OK);
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, CancelButtonHdl, void*, EMPTYARG )
+{
+ EndDialog(DLG_RET_CANCEL);
+ return 0;
+}
+
+//===============================================
+IMPL_LINK( BrokenRecoveryDialog, SaveButtonHdl, void*, EMPTYARG )
+{
+ impl_askForSavePath();
+ return 0;
+}
+
+//===============================================
+void BrokenRecoveryDialog::impl_askForSavePath()
+{
+ css::uno::Reference< css::ui::dialogs::XFolderPicker > xFolderPicker(
+ m_pCore->getSMGR()->createInstance(SERVICENAME_FOLDERPICKER), css::uno::UNO_QUERY_THROW);
+
+ INetURLObject aURL(m_sSavePath, INET_PROT_FILE);
+ xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::NO_DECODE));
+ short nRet = xFolderPicker->execute();
+ if (nRet == css::ui::dialogs::ExecutableDialogResults::OK)
+ {
+ m_sSavePath = xFolderPicker->getDirectory();
+ String sPath;
+ ::utl::LocalFileHelper::ConvertURLToSystemPath( m_sSavePath, sPath );
+ m_aSaveDirED.SetText( sPath );
+ }
+}
+
+//===============================================
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Welcome Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepWelcomeDialog::ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack )
+ :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_WELCOME ) )
+ ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) )
+ ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) )
+ ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) )
+ ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) )
+ ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) )
+ ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) )
+ ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) )
+ ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) )
+ {
+ FreeResource();
+
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ maTitleWin.SetBackground( aBack );
+ maTitleFT.SetBackground( aBack );
+
+ Font aFnt( maTitleFT.GetFont() );
+ aFnt.SetWeight( WEIGHT_BOLD );
+ maTitleFT.SetFont( aFnt );
+
+ maPrevBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, PrevBtnHdl ) );
+ maPrevBtn.Enable( _bAllowBack );
+
+ maNextBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, NextBtnHdl ) );
+ maNextBtn.Enable( sal_True );
+
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepWelcomeDialog, CancelBtnHdl ) );
+ maCancelBtn.Enable( sal_True );
+ }
+
+ ErrorRepWelcomeDialog::~ErrorRepWelcomeDialog()
+ {
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, PrevBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_BACK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, NextBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_OK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepWelcomeDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_CANCEL;
+ return 0;
+ }
+
+ short ErrorRepWelcomeDialog::execute()
+ {
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+ Show();
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+ return m_nResult;
+ }
+
+ void ErrorRepWelcomeDialog::setDefButton()
+ {
+ maNextBtn.GrabFocus();
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Send Dialog and its MultiLineEdit
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorDescriptionEdit::ErrorDescriptionEdit( Window* pParent, const ResId& rResId ) :
+
+ MultiLineEdit( pParent, rResId )
+
+ {
+ SetModifyHdl( LINK( this, ErrorDescriptionEdit, ModifyHdl ) );
+ if ( GetVScrollBar() )
+ GetVScrollBar()->Hide();
+ }
+
+ ErrorDescriptionEdit::~ErrorDescriptionEdit()
+ {
+ }
+
+ IMPL_LINK( ErrorDescriptionEdit, ModifyHdl, void*, EMPTYARG )
+ {
+ if ( !GetVScrollBar() )
+ return 0;
+
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ DBG_ASSERT( pTextEngine, "no text engine" );
+
+ sal_uIntPtr i, nParaCount = pTextEngine->GetParagraphCount();
+ sal_uInt16 nLineCount = 0;
+
+ for ( i = 0; i < nParaCount; ++i )
+ nLineCount = nLineCount + pTextEngine->GetLineCount(i);
+
+ sal_uInt16 nVisCols = 0, nVisLines = 0;
+ GetMaxVisColumnsAndLines( nVisCols, nVisLines );
+ GetVScrollBar()->Show( nLineCount > nVisLines );
+
+ return 0;
+ }
+
+ ErrorRepSendDialog::ErrorRepSendDialog( Window* _pParent )
+ :IExtendedTabPage ( _pParent, SVX_RES( RID_SVXPAGE_ERR_REP_SEND ) )
+ ,maTitleWin ( this, SVX_RES( WIN_RECOV_TITLE ) )
+ ,maTitleFT ( this, SVX_RES( FT_RECOV_TITLE ) )
+ ,maTitleFL ( this, SVX_RES( FL_RECOV_TITLE ) )
+ ,maDescrFT ( this, SVX_RES( FT_RECOV_DESCR ) )
+
+ ,maDocTypeFT ( this, SVX_RES( FT_ERRSEND_DOCTYPE ) )
+ ,maDocTypeED ( this, SVX_RES( ED_ERRSEND_DOCTYPE ) )
+ ,maUsingFT ( this, SVX_RES( FT_ERRSEND_USING ) )
+ ,maUsingML ( this, SVX_RES( ML_ERRSEND_USING ) )
+ ,maShowRepBtn ( this, SVX_RES( BTN_ERRSEND_SHOWREP ) )
+ ,maOptBtn ( this, SVX_RES( BTN_ERRSEND_OPT ) )
+ ,maContactCB ( this, SVX_RES( CB_ERRSEND_CONTACT ) )
+ ,maEMailAddrFT ( this, SVX_RES( FT_ERRSEND_EMAILADDR ) )
+ ,maEMailAddrED ( this, SVX_RES( ED_ERRSEND_EMAILADDR ) )
+
+ ,maBottomFL ( this, SVX_RES( FL_RECOV_BOTTOM ) )
+ ,maPrevBtn ( this, SVX_RES( BTN_RECOV_PREV ) )
+ ,maNextBtn ( this, SVX_RES( BTN_RECOV_NEXT ) )
+ ,maCancelBtn ( this, SVX_RES( BTN_RECOV_CANCEL ) )
+ {
+ FreeResource();
+
+ initControls();
+
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ maTitleWin.SetBackground( aBack );
+ maTitleFT.SetBackground( aBack );
+
+ Font aFnt( maTitleFT.GetFont() );
+ aFnt.SetWeight( WEIGHT_BOLD );
+ maTitleFT.SetFont( aFnt );
+
+ maShowRepBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, ShowRepBtnHdl ) );
+ maOptBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, OptBtnHdl ) );
+ maContactCB.SetClickHdl( LINK( this, ErrorRepSendDialog, ContactCBHdl ) );
+ maPrevBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, PrevBtnHdl ) );
+ maNextBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, SendBtnHdl ) );
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepSendDialog, CancelBtnHdl ) );
+
+ ReadParams();
+
+ /*
+ maDocTypeED.SetText( maParams.maSubject );
+ maUsingML.SetText( maParams.maBody );
+ maContactCB.Check( maParams.mbAllowContact );
+ maEMailAddrED.SetText( maParams.maReturnAddress );
+ */
+ ContactCBHdl( 0 );
+ }
+
+ ErrorRepSendDialog::~ErrorRepSendDialog()
+ {
+ }
+
+ short ErrorRepSendDialog::execute()
+ {
+ ::vos::OGuard aLock(Application::GetSolarMutex());
+ Show();
+ m_nResult = DLG_RET_UNKNOWN;
+ while(m_nResult == DLG_RET_UNKNOWN)
+ Application::Yield();
+ return m_nResult;
+ }
+
+ void ErrorRepSendDialog::setDefButton()
+ {
+ // set first focus
+ maDocTypeED.GrabFocus();
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, PrevBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_BACK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ m_nResult = DLG_RET_CANCEL;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, SendBtnHdl, void*, EMPTYARG )
+ {
+
+ SaveParams();
+ SendReport();
+
+ m_nResult = DLG_RET_OK;
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, ShowRepBtnHdl, void*, EMPTYARG )
+ {
+ ErrorRepPreviewDialog aDlg( this );
+ aDlg.Execute();
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, OptBtnHdl, void*, EMPTYARG )
+ {
+ ErrorRepOptionsDialog aDlg( this, maParams );
+ aDlg.Execute();
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepSendDialog, ContactCBHdl, void*, EMPTYARG )
+ {
+ bool bCheck = maContactCB.IsChecked();
+ maEMailAddrFT.Enable( bCheck );
+ maEMailAddrED.Enable( bCheck );
+ return 0;
+ }
+
+ void ErrorRepSendDialog::initControls()
+ {
+ // if the text is too short for two lines, insert a newline
+ String sText = maDocTypeFT.GetText();
+ if ( maDocTypeFT.GetCtrlTextWidth( sText ) <= maDocTypeFT.GetSizePixel().Width() )
+ {
+ sText.Insert( '\n', 0 );
+ maDocTypeFT.SetText( sText );
+ }
+
+ // if the button text is too wide, then broaden the button
+ sText = maShowRepBtn.GetText();
+ long nTxtW = maShowRepBtn.GetCtrlTextWidth( sText );
+ long nBtnW = maShowRepBtn.GetSizePixel().Width();
+ if ( nTxtW >= nBtnW )
+ {
+ const long nMinDelta = 10;
+ long nDelta = Max( nTxtW - nBtnW, nMinDelta );
+ sal_uInt32 i = 0;
+ Window* pWins[] =
+ {
+ &maShowRepBtn, &maOptBtn,
+ &maDescrFT, &maDocTypeFT, &maDocTypeED, &maUsingFT,
+ &maUsingML, &maContactCB, &maEMailAddrFT, &maEMailAddrED
+ };
+ // the first two buttons need a new size (wider) and position (more left)
+ Window** pCurrent = pWins;
+ const sal_uInt32 nBtnCount = 2;
+ for ( ; i < nBtnCount; ++i, ++pCurrent )
+ {
+ Size aNewSize = (*pCurrent)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pCurrent)->SetSizePixel( aNewSize );
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.X() -= nDelta;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+
+ // loop through all the other windows and adjust their size
+ for ( ; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ Size aSize = (*pCurrent)->GetSizePixel();
+ aSize.Width() -= nDelta;
+ (*pCurrent)->SetSizePixel( aSize );
+ }
+ }
+ }
+
+ String ErrorRepSendDialog::GetDocType( void ) const
+ {
+ return maDocTypeED.GetText();
+ }
+
+ String ErrorRepSendDialog::GetUsing( void ) const
+ {
+ return maUsingML.GetText();
+ }
+
+ bool ErrorRepSendDialog::IsContactAllowed( void ) const
+ {
+ return maContactCB.IsChecked();
+ }
+
+ String ErrorRepSendDialog::GetEMailAddress( void ) const
+ {
+ return maEMailAddrED.GetText();
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Options Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepOptionsDialog::ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& _rParams )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_OPTIONS ) )
+ ,maProxyFL( this, SVX_RES( FL_ERROPT_PROXY ) )
+ ,maSystemBtn( this, SVX_RES( BTN_ERROPT_SYSTEM ) )
+ ,maDirectBtn( this, SVX_RES( BTN_ERROPT_DIRECT ) )
+ ,maManualBtn( this, SVX_RES( BTN_ERROPT_MANUAL ) )
+ ,maProxyServerFT( this, SVX_RES( FT_ERROPT_PROXYSERVER ) )
+ ,maProxyServerEd( this, SVX_RES( ED_ERROPT_PROXYSERVER ) )
+ ,maProxyPortFT( this, SVX_RES( FT_ERROPT_PROXYPORT ) )
+ ,maProxyPortEd( this, SVX_RES( ED_ERROPT_PROXYPORT ) )
+ ,maDescriptionFT( this, SVX_RES( FT_ERROPT_DESCRIPTION ) )
+ ,maButtonsFL( this, SVX_RES( FL_ERROPT_BUTTONS ) )
+ ,maOKBtn( this, SVX_RES( BTN_ERROPT_OK ) )
+ ,maCancelBtn( this, SVX_RES( BTN_ERROPT_CANCEL ) )
+ ,mrParams( _rParams )
+ {
+ FreeResource();
+
+ maManualBtn.SetToggleHdl( LINK( this, ErrorRepOptionsDialog, ManualBtnHdl ) );
+ maCancelBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, CancelBtnHdl ) );
+ maOKBtn.SetClickHdl( LINK( this, ErrorRepOptionsDialog, OKBtnHdl ) );
+
+ maProxyServerEd.SetText( mrParams.maHTTPProxyServer );
+ maProxyPortEd.SetText( mrParams.maHTTPProxyPort );
+
+#ifndef WNT
+ // no "Use system settings" button on non windows systems
+ // so hide this button
+ maSystemBtn.Hide();
+ long nDelta = maDirectBtn.GetPosPixel().Y() - maSystemBtn.GetPosPixel().Y();
+ // and loop through all these controls and adjust their position
+ Window* pWins[] =
+ {
+ &maDirectBtn, &maManualBtn, &maProxyServerFT,
+ &maProxyServerEd, &maProxyPortFT, &maProxyPortEd, &maDescriptionFT
+ };
+ Window** pCurrent = pWins;
+ for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ Point aPos = (*pCurrent)->GetPosPixel();
+ aPos.Y() -= nDelta;
+ (*pCurrent)->SetPosPixel( aPos );
+ }
+#endif
+
+
+ switch ( mrParams.miHTTPConnectionType )
+ {
+ default:
+#ifdef WNT
+ case 0:
+ maSystemBtn.Check( sal_True );
+ break;
+#endif
+ case 1:
+ maDirectBtn.Check( sal_True );
+ break;
+ case 2:
+ maManualBtn.Check( sal_True );
+ break;
+ }
+
+ ManualBtnHdl( 0 );
+ }
+
+ ErrorRepOptionsDialog::~ErrorRepOptionsDialog()
+ {
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, ManualBtnHdl, void*, EMPTYARG )
+ {
+ bool bCheck = maManualBtn.IsChecked();
+ maProxyServerFT.Enable( bCheck );
+ maProxyServerEd.Enable( bCheck );
+ maProxyPortFT.Enable( bCheck );
+ maProxyPortEd.Enable( bCheck );
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, OKBtnHdl, void*, EMPTYARG )
+ {
+ if ( maManualBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 2;
+ else if ( maDirectBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 1;
+ else if ( maSystemBtn.IsChecked() )
+ mrParams.miHTTPConnectionType = 0;
+
+ mrParams.maHTTPProxyServer = maProxyServerEd.GetText();
+ mrParams.maHTTPProxyPort = maProxyPortEd.GetText();
+
+ EndDialog(DLG_RET_OK);
+ return 0;
+ }
+
+ IMPL_LINK( ErrorRepOptionsDialog, CancelBtnHdl, void*, EMPTYARG )
+ {
+ EndDialog(DLG_RET_CANCEL);
+ return 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Edit (MultiLineEdit with fixed font)
+ ///////////////////////////////////////////////////////////////////////
+
+ ErrorRepEdit::ErrorRepEdit( Window* pParent, const ResId& rResId ) :
+ ExtMultiLineEdit( pParent, rResId )
+ {
+ // fixed font for error report
+ Color aColor = GetTextColor();
+
+ Font aFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_FIXED, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE );
+
+ // Set font color because the default font color is transparent !!!
+ aFont.SetColor( aColor );
+
+ GetTextEngine()->SetFont( aFont );
+
+ // no blinking cursor and a little left margin
+ EnableCursor( sal_False );
+ SetLeftMargin( 4 );
+ }
+
+ ErrorRepEdit::~ErrorRepEdit()
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////
+ // Error Report Preview Dialog
+ ///////////////////////////////////////////////////////////////////////
+
+
+ static ::rtl::OUString GetCrashConfigDir()
+ {
+
+#if defined(WNT) || defined(OS2)
+ OUString ustrValue = OUString::createFromAscii("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}");
+#elif defined( MACOSX )
+ OUString ustrValue = OUString::createFromAscii("~");
+#else
+ OUString ustrValue = OUString::createFromAscii("$SYSUSERCONFIG");
+#endif
+ Bootstrap::expandMacros( ustrValue );
+
+#if defined(WNT) || defined(OS2)
+ ustrValue += OUString::createFromAscii("/user/crashdata");
+#endif
+ return ustrValue;
+ }
+
+#if defined(WNT) || defined(OS2)
+#define CHKFILE "crashdat.chk"
+#define STKFILE "crashdat.stk"
+#define PRVFILE "crashdat.prv"
+#else
+#define CHKFILE ".crash_report_checksum"
+#define STKFILE ".crash_report_frames"
+#define PRVFILE ".crash_report_preview"
+#endif
+
+// static ::rtl::OUString GetChecksumURL()
+// {
+// ::rtl::OUString aURL = GetCrashConfigDir();
+
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHKFILE ) );
+
+// return aURL;
+// }
+
+// static ::rtl::OUString GetStackURL()
+// {
+// ::rtl::OUString aURL = GetCrashConfigDir();
+
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+// aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STKFILE ) );
+
+// return aURL;
+// }
+
+ static ::rtl::OUString GetPreviewURL()
+ {
+ ::rtl::OUString aURL = GetCrashConfigDir();
+
+ aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+ aURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( PRVFILE ) );
+
+ return aURL;
+ }
+
+ static String LoadCrashFile( const ::rtl::OUString &rURL )
+ {
+ String aFileContent;
+ ::osl::File aFile( rURL );
+
+ printf( "Loading %s:", OString( rURL.getStr(), rURL.getLength(), osl_getThreadTextEncoding() ).getStr() );
+ if ( ::osl::FileBase::E_None == aFile.open( OpenFlag_Read ) )
+ {
+ ::rtl::OString aContent;
+ ::osl::FileBase::RC result;
+ sal_uInt64 aBytesRead;
+
+ do
+ {
+ sal_Char aBuffer[256];
+
+ result = aFile.read( aBuffer, sizeof(aBuffer), aBytesRead );
+
+ if ( ::osl::FileBase::E_None == result )
+ {
+ ::rtl::OString aTemp( aBuffer, static_cast< xub_StrLen >( aBytesRead ) );
+ aContent += aTemp;
+ }
+ } while ( ::osl::FileBase::E_None == result && aBytesRead );
+
+ ::rtl::OUString ustrContent( aContent.getStr(), aContent.getLength(), RTL_TEXTENCODING_UTF8 );
+ aFileContent = ustrContent;
+
+ aFile.close();
+
+ printf( "SUCCEEDED\n" );
+ }
+ else
+ printf( "FAILED\n" );
+
+ return aFileContent;
+ }
+
+
+
+ ErrorRepPreviewDialog::ErrorRepPreviewDialog( Window* _pParent )
+ :ModalDialog ( _pParent, SVX_RES( RID_SVX_MDLG_ERR_REP_PREVIEW ) )
+ ,maContentML( this, SVX_RES( ML_ERRPREVIEW_CONTENT ) )
+ ,maOKBtn( this, SVX_RES( BTN_ERRPREVIEW_OK ) )
+
+ {
+ FreeResource();
+
+ mnMinHeight = ( maContentML.GetSizePixel().Height() / 2 );
+
+ String aPreview = LoadCrashFile( GetPreviewURL() );
+ ErrorRepSendDialog *pMainDlg = (ErrorRepSendDialog *)_pParent;
+
+ String aSeperator = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\r\n\r\n================\r\n\r\n" ) );
+
+ String aContent = pMainDlg->GetDocType();
+ if ( aContent.Len() > 0 )
+ aContent += aSeperator;
+ aContent += pMainDlg->GetUsing();
+ if ( aContent.Len() > 0 )
+ aContent += aSeperator;
+ aContent += aPreview;
+
+ maContentML.SetText( aContent );
+ }
+
+ ErrorRepPreviewDialog::~ErrorRepPreviewDialog()
+ {
+ }
+
+ void ErrorRepPreviewDialog::Resize()
+ {
+ Size a3Sz = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Size aWinSz = GetSizePixel();
+ Size aBtnSz = maOKBtn.GetSizePixel();
+ Point aEditPnt = maContentML.GetPosPixel();
+
+ long nNewHeight = Max( aWinSz.Height() - aEditPnt.Y() - 3 * a3Sz.Height() - aBtnSz.Height(), mnMinHeight );
+ long nNewWidth = aWinSz.Width() - 4 * a3Sz.Width();
+
+ Size aNewSize( nNewWidth, nNewHeight );
+ maContentML.SetSizePixel( aNewSize );
+ Point aNewPoint( Max( aEditPnt.X() + aNewSize.Width() - aBtnSz.Width(), aEditPnt.X() ),
+ aEditPnt.Y() + aNewSize.Height() + a3Sz.Height() );
+ maOKBtn.SetPosPixel( aNewPoint );
+ }
+ } // namespace DocRecovery
+} // namespace svx
+
diff --git a/svx/source/dialog/docrecovery.hrc b/svx/source/dialog/docrecovery.hrc
new file mode 100644
index 000000000000..acf1a1631c6b
--- /dev/null
+++ b/svx/source/dialog/docrecovery.hrc
@@ -0,0 +1,292 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DOCRECOVERY_HRC
+#define _SVX_DOCRECOVERY_HRC
+
+#include <svtools/controldims.hrc>
+
+// general
+
+#define PROGR_HEIGHT (RSC_CD_PUSHBUTTON_HEIGHT)
+
+// TabDialog
+#define TABDLG_WIDTH 290
+#define TABDLG_HEIGHT 238
+
+// TabPage CrashSave
+
+#define WIN_SAVE_TITLE 1
+#define FT_SAVE_TITLE 2
+#define FL_SAVE_TITLE 3
+#define FT_SAVE_DESCR 4
+#define FT_SAVE_FILELIST 5
+#define LB_SAVE_FILELIST 6
+#define CB_SAVE_LAUNCHAUTO 7
+#define FL_SAVE_BOTTOM 8
+#define BT_SAVE_OK 9
+
+
+#define SAVE_WIDTH 290
+#define SAVE_HEIGHT 238
+#define SAVE_TITLEWINHEIGHT 36
+#define SAVE_DESCRHEIGHT 48
+#define SAVE_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define SAVE_COL2 (SAVE_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define SAVE_COL1 (SAVE_COL2-RSC_CD_PUSHBUTTON_WIDTH)
+#define SAVE_ROW0 ((SAVE_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define SAVE_ROW1 (SAVE_TITLEWINHEIGHT)
+#define SAVE_ROW2 (SAVE_ROW1+RSC_SP_CTRL_Y)
+#define SAVE_ROW3 (SAVE_ROW2+3*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVE_ROW4 (SAVE_ROW3+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVE_ROW9 (SAVE_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define SAVE_ROW8 (SAVE_ROW9-RSC_CD_PUSHBUTTON_HEIGHT)
+#define SAVE_ROW7 (SAVE_ROW8-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define SAVE_ROW6 (SAVE_ROW7-RSC_SP_CTRL_GROUP_Y-RSC_CD_CHECKBOX_HEIGHT)
+#define SAVE_ROW5 (SAVE_ROW6-RSC_SP_CTRL_Y)
+#define SAVE_FILELISTHEIGHT (SAVE_ROW5-SAVE_ROW4)
+#define SAVE_CONTROLWIDTH (SAVE_COL2-SAVE_COL0)
+
+// Save Progress Dialog
+
+#define FT_SAVEPROGR_HINT 1
+#define FT_SAVEPROGR_PROGR 2
+#define WIN_SAVEPROGR_PROGR 3
+
+#define SAVEPROGR_WIDTH 240
+#define SAVEPROGR_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define SAVEPROGR_COL1 (SAVEPROGR_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define SAVEPROGR_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define SAVEPROGR_ROW1 (SAVEPROGR_ROW0+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_Y)
+#define SAVEPROGR_ROW2 (SAVEPROGR_ROW1+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define SAVEPROGR_ROW3 (SAVEPROGR_ROW2+PROGR_HEIGHT)
+#define SAVEPROGR_CONTROLWIDTH (SAVEPROGR_COL1-SAVEPROGR_COL0)
+#define SAVEPROGR_HEIGHT (SAVEPROGR_ROW3+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+// TabPage Recovery
+
+#define WIN_RECOV_TITLE 1
+#define FT_RECOV_TITLE 2
+#define FL_RECOV_TITLE 3
+#define FT_RECOV_DESCR 4
+#define FT_RECOV_PROGR 5
+#define WIN_RECOV_PROGR 6
+#define FT_RECOV_FILELIST 7
+#define LB_RECOV_FILELIST 8
+#define FL_RECOV_BOTTOM 9
+#define BTN_RECOV_PREV 10
+#define BTN_RECOV_NEXT 11
+#define BTN_RECOV_CANCEL 12
+#define STR_HEADERBAR 13
+#define IMG_GREENCHECK 14
+#define IMG_YELLOWCHECK 15
+#define IMG_REDCROSS 16
+#define IMG_GREENCHECK_HC 17
+#define IMG_YELLOWCHECK_HC 18
+#define IMG_REDCROSS_HC 19
+#define STR_SUCCESSRECOV 20
+#define STR_ORIGDOCRECOV 21
+#define STR_RECOVFAILED 22
+#define STR_RECOVINPROGR 23
+#define STR_NOTRECOVYET 24
+#define STR_RECOVERY_NEXT 25
+#define STR_RECOVERY_INPROGRESS 26
+#define STR_RECOVERY_REPORT 27
+#define STR_RECOVERYONLY_FINISH_DESCR 28
+#define STR_RECOVERYONLY_FINISH 29
+
+#define RECOV_WIDTH SAVE_WIDTH
+#define RECOV_HEIGHT SAVE_HEIGHT
+#define RECOV_TITLEWINHEIGHT SAVE_TITLEWINHEIGHT
+#define RECOV_DESCRHEIGHT 6*RSC_CD_FIXEDTEXT_HEIGHT
+#define RECOV_COL1 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define RECOV_COL2 40
+#define RECOV_COL3 (RECOV_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define RECOV_COL_A (RECOV_COL1)
+#define RECOV_COL_B (COL_1+RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_G (RECOV_COL3)
+#define RECOV_COL_F (RECOV_COL_G-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_E (RECOV_COL_F-RSC_SP_CTRL_X)
+#define RECOV_COL_D (RECOV_COL_E-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_COL_C (RECOV_COL_D-RSC_CD_PUSHBUTTON_WIDTH)
+#define RECOV_ROW0 ((RECOV_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define RECOV_ROW1 (RECOV_TITLEWINHEIGHT)
+#define RECOV_ROW2 (RECOV_ROW1+RSC_SP_CTRL_Y)
+#define RECOV_ROW3 (RECOV_ROW2+RECOV_DESCRHEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW4 (RECOV_ROW3+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW5 (RECOV_ROW4+PROGR_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define RECOV_ROW6 (RECOV_ROW5+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define RECOV_ROW10 (RECOV_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define RECOV_ROW9 (RECOV_ROW10-RSC_CD_PUSHBUTTON_HEIGHT)
+#define RECOV_ROW8 (RECOV_ROW9-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define RECOV_ROW7 (RECOV_ROW8-RSC_SP_CTRL_GROUP_Y)
+#define RECOV_FILELISTHEIGHT (RECOV_ROW7-RECOV_ROW6)
+#define RECOV_CONTROLWIDTH (SAVE_COL2-SAVE_COL0)
+
+// TabPage Broken Recovery
+
+#define FT_BROKEN_DESCR 1
+#define FT_BROKEN_FILELIST 2
+#define LB_BROKEN_FILELIST 3
+#define FT_BROKEN_SAVEDIR 4
+#define ED_BROKEN_SAVEDIR 5
+#define BTN_BROKEN_SAVEDIR 6
+#define FL_BROKEN_BOTTOM 7
+#define BTN_BROKEN_OK 8
+#define BTN_BROKEN_CANCEL 9
+
+#define BROKEN_WIDTH 210
+#define BROKEN_HEIGHT 160
+#define BROKEN_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define BROKEN_COL4 (BROKEN_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define BROKEN_COL3 (BROKEN_COL4-RSC_CD_PUSHBUTTON_WIDTH)
+#define BROKEN_COL2 (BROKEN_COL3-RSC_SP_CTRL_GROUP_X)
+#define BROKEN_COL1 (BROKEN_COL2-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define BROKEN_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define BROKEN_ROW1 (BROKEN_ROW0+5*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define BROKEN_ROW2 (BROKEN_ROW1+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define BROKEN_ROW8 (BROKEN_HEIGHT-RSC_SP_DLG_INNERBORDER_BOTTOM)
+#define BROKEN_ROW7 (BROKEN_ROW8-RSC_CD_PUSHBUTTON_HEIGHT)
+#define BROKEN_ROW6 (BROKEN_ROW7-RSC_SP_FLGR_INNERBORDER_BOTTOM-RSC_CD_FIXEDLINE_HEIGHT)
+#define BROKEN_ROW5 (BROKEN_ROW6-RSC_SP_FLGR_INNERBORDER_TOP-RSC_CD_PUSHBUTTON_HEIGHT)
+#define BROKEN_ROW4 (BROKEN_ROW5-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDTEXT_HEIGHT)
+#define BROKEN_ROW3 (BROKEN_ROW4-RSC_SP_CTRL_GROUP_Y)
+
+#define BROKEN_CONTROLWIDTH (BROKEN_COL4-BROKEN_COL0)
+
+// TabPage Error Report Welcome
+// most defines equal to TabPage Recovery
+
+#define RECOV_DESCR_HEIGHT (RECOV_ROW7-RECOV_ROW2)
+
+// TabPage Error Report Send
+// borrow basic metrics from TabPage Recovery
+
+#define FT_ERRSEND_DOCTYPE 20
+#define ED_ERRSEND_DOCTYPE 21
+#define FT_ERRSEND_USING 22
+#define ML_ERRSEND_USING 23
+#define BTN_ERRSEND_SHOWREP 24
+#define BTN_ERRSEND_OPT 25
+#define CB_ERRSEND_CONTACT 26
+#define FT_ERRSEND_EMAILADDR 27
+#define ED_ERRSEND_EMAILADDR 28
+
+#define ERRSEND_WIDTH (RECOV_WIDTH)
+#define ERRSEND_HEIGHT (RECOV_HEIGHT)
+#define ERRSEND_TITLEWINHEIGHT SAVE_TITLEWINHEIGHT
+
+#define ERRSEND_COL0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERRSEND_COL1 (ERRSEND_COL0+RSC_SP_CHK_TEXTINDENT)
+
+#define ERRSEND_COL4 (ERRSEND_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERRSEND_COL3 (ERRSEND_COL4-RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRSEND_COL2 (ERRSEND_COL3-RSC_SP_CTRL_X)
+
+#define ERRSEND_COL6 (ERRSEND_COL3-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRSEND_COL5 (ERRSEND_COL6-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ERRSEND_CONTROLWIDTH1 (ERRSEND_COL4-ERRSEND_COL0)
+#define ERRSEND_CONTROLWIDTH2 (ERRSEND_COL2-ERRSEND_COL0)
+#define ERRSEND_CONTROLWIDTH3 (ERRSEND_COL2-ERRSEND_COL1)
+
+#define ERRSEND_ROW0 ((ERRSEND_TITLEWINHEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)
+#define ERRSEND_ROW1 (ERRSEND_TITLEWINHEIGHT)
+#define ERRSEND_ROW2 (ERRSEND_ROW1+RSC_SP_CTRL_Y)
+#define ERRSEND_ROW3 (ERRSEND_ROW2+3*RSC_CD_FIXEDTEXT_HEIGHT)
+#define ERRSEND_ROW4 (ERRSEND_ROW3+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW5 (ERRSEND_ROW4+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW6 (ERRSEND_ROW5+RSC_CD_TEXTBOX_HEIGHT)
+#define ERRSEND_ROW7 (ERRSEND_ROW6+RSC_SP_CTRL_Y)
+#define ERRSEND_ROW8 (ERRSEND_ROW7+RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW9 (ERRSEND_ROW8+RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERRSEND_ROW10 (ERRSEND_ROW9+RSC_SP_CTRL_GROUP_Y)
+#define ERRSEND_ROW11 (ERRSEND_ROW10+RSC_CD_PUSHBUTTON_HEIGHT)
+
+#define ERRSEND_ROW16 (ERRSEND_HEIGHT-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERRSEND_ROW15 (ERRSEND_ROW16-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDLINE_HEIGHT)
+#define ERRSEND_ROW14 (ERRSEND_ROW15-RSC_SP_CTRL_GROUP_Y-RSC_CD_TEXTBOX_HEIGHT)
+#define ERRSEND_ROW13 (ERRSEND_ROW14-RSC_SP_CTRL_GROUP_Y-RSC_CD_FIXEDTEXT_HEIGHT)
+#define ERRSEND_ROW12 (ERRSEND_ROW13-RSC_SP_CTRL_GROUP_Y-RSC_CD_CHECKBOX_HEIGHT)
+
+// Error Report Options Dialog
+
+#define ERROPT_WIDTH 220
+#define ERROPT_HEIGHT 180
+
+#define FL_ERROPT_PROXY 1
+#define BTN_ERROPT_SYSTEM 2
+#define BTN_ERROPT_DIRECT 3
+#define BTN_ERROPT_MANUAL 4
+#define FT_ERROPT_PROXYSERVER 5
+#define ED_ERROPT_PROXYSERVER 6
+#define FT_ERROPT_PROXYPORT 7
+#define ED_ERROPT_PROXYPORT 8
+#define FT_ERROPT_DESCRIPTION 9
+#define FL_ERROPT_BUTTONS 10
+#define BTN_ERROPT_OK 11
+#define BTN_ERROPT_CANCEL 12
+
+#define ERROPT_COLA (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERROPT_COLB (ERROPT_COLA + RSC_SP_CTRL_X)
+#define ERROPT_COLC (ERROPT_COLB + RSC_SP_CHK_TEXTINDENT)
+
+#define ERROPT_COLF (ERROPT_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERROPT_COLE (ERROPT_COLF - RSC_CD_PUSHBUTTON_WIDTH)
+#define ERROPT_COLD (ERROPT_COLE - RSC_SP_CTRL_DESC_X - RSC_CD_PUSHBUTTON_WIDTH)
+
+#define ERROPT_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ERROPT_ROW1 (ERROPT_ROW0 + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_CTRL_Y)
+#define ERROPT_ROW2 (ERROPT_ROW1 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW3 (ERROPT_ROW2 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW4 (ERROPT_ROW3 + RSC_CD_RADIOBUTTON_HEIGHT + RSC_SP_CTRL_GROUP_Y)
+#define ERROPT_ROW5 (ERROPT_ROW4 + RSC_CD_FIXEDTEXT_HEIGHT + RSC_SP_CTRL_DESC_Y)
+#define ERROPT_ROW6 (ERROPT_ROW5 + RSC_CD_TEXTBOX_HEIGHT + RSC_SP_CTRL_Y)
+
+#define ERROPT_ROW9 (ERROPT_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT)
+#define ERROPT_ROW8 (ERROPT_ROW9 - RSC_SP_CTRL_DESC_Y - RSC_CD_FIXEDLINE_HEIGHT)
+#define ERROPT_ROW7 (ERROPT_ROW8 - RSC_SP_CTRL_DESC_Y)
+
+#define ERROPT_SERVER_WIDTH 150
+#define ERROPT_PORT_WIDTH (ERROPT_COLF-ERROPT_COLC-RSC_SP_CTRL_GROUP_X-ERROPT_SERVER_WIDTH)
+
+// Error Report Preview Dialog
+
+#define ERRPREVIEW_WIDTH 300
+#define ERRPREVIEW_HEIGHT 200
+
+#define ML_ERRPREVIEW_CONTENT 1
+#define BTN_ERRPREVIEW_OK 2
+#define ERRPREVIEW_COLA (RSC_SP_DLG_INNERBORDER_LEFT)
+#define ERRPREVIEW_COLB (ERRPREVIEW_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_CD_PUSHBUTTON_WIDTH)
+#define ERRPREVIEW_COLC (ERRPREVIEW_WIDTH - RSC_SP_DLG_INNERBORDER_RIGHT)
+#define ERRPREVIEW_ROW0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ERRPREVIEW_ROW1 (ERRPREVIEW_ROW2 - RSC_SP_CTRL_Y)
+#define ERRPREVIEW_ROW2 (ERRPREVIEW_HEIGHT - RSC_SP_DLG_INNERBORDER_BOTTOM - RSC_CD_PUSHBUTTON_HEIGHT)
+
+#endif
diff --git a/svx/source/dialog/docrecovery.src b/svx/source/dialog/docrecovery.src
new file mode 100644
index 000000000000..cf9cf6f0adcf
--- /dev/null
+++ b/svx/source/dialog/docrecovery.src
@@ -0,0 +1,654 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+
+#include "docrecovery.hrc"
+
+TabDialog RID_SVX_TABDLG_DOCRECOVERY
+{
+ Size = MAP_APPFONT( TABDLG_WIDTH, TABDLG_HEIGHT );
+ HelpId = HID_SVX_TABDLG_DOCRECOVERY;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = FALSE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+};
+
+TabPage RID_SVXPAGE_DOCRECOVERY_SAVE
+{
+ Size = MAP_APPFONT( SAVE_WIDTH, SAVE_HEIGHT );
+ HelpId = HID_SVX_TP_DOCRECOVERY_SAVE;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( SAVE_WIDTH, SAVE_ROW1 );
+ };
+ FixedText FT_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW0 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "%PRODUCTNAME Document Recovery";
+ };
+ FixedLine FL_SAVE_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , SAVE_ROW1 );
+ Size = MAP_APPFONT( SAVE_WIDTH, 2 );
+ };
+ FixedText FT_SAVE_DESCR
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW2 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, (SAVE_ROW3-SAVE_ROW2-RSC_SP_CTRL_DESC_Y) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Due to an unexpected error, %PRODUCTNAME crashed. All the files you were working on will now be saved. The next time %PRODUCTNAME is launched, your files will be recovered automatically.";
+ };
+ FixedText FT_SAVE_FILELIST
+ {
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW3 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "The following files will be recovered:";
+ };
+ ListBox LB_SAVE_FILELIST
+ {
+ HelpID = "svx:ListBox:RID_SVXPAGE_DOCRECOVERY_SAVE:LB_SAVE_FILELIST";
+ Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW4 );
+ Size = MAP_APPFONT( SAVE_CONTROLWIDTH, SAVE_FILELISTHEIGHT );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ FixedLine FL_SAVE_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , SAVE_ROW7 );
+ Size = MAP_APPFONT( SAVE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton BT_SAVE_OK
+ {
+ Pos = MAP_APPFONT( SAVE_COL1 , SAVE_ROW8 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+};
+
+ModalDialog RID_SVX_MDLG_DOCRECOVERY_PROGR
+{
+ Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT );
+ HelpId = HID_SVX_MDLG_DOCRECOVERY_PROGR;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Closeable = FALSE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+
+ FixedText FT_SAVEPROGR_HINT
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW0 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Documents are being saved.";
+ };
+ FixedText FT_SAVEPROGR_PROGR
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW1 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Progress of saving: ";
+ };
+ Window WIN_SAVEPROGR_PROGR
+ {
+ Pos = MAP_APPFONT( SAVEPROGR_COL0, SAVEPROGR_ROW2 );
+ Size = MAP_APPFONT( SAVEPROGR_CONTROLWIDTH, PROGR_HEIGHT );
+ Border = TRUE;
+ };
+};
+
+TabPage RID_SVXPAGE_DOCRECOVERY_RECOVER
+{
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_HEIGHT );
+ HelpId = HID_SVX_TP_DOCRECOVERY_RECOVER;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW0 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "%PRODUCTNAME Document Recovery";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW2 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RECOV_DESCRHEIGHT );
+ WordBreak = TRUE;
+ Text[ en-US ] = "Press 'Start Recovery' to start the recovery process of the documents listed below.\n\nThe 'Status' column shows whether the document could be recovered.";
+ };
+ FixedText FT_RECOV_PROGR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW3 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Recovering document:";
+ };
+ Window WIN_RECOV_PROGR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW4 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, PROGR_HEIGHT );
+ Border = TRUE;
+ };
+ FixedText FT_RECOV_FILELIST
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW5 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Status of recovered documents:";
+ };
+ String STR_HEADERBAR
+ {
+ Text[ en-US ] = "Document Name\tStatus";
+ };
+ Control LB_RECOV_FILELIST
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW6 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RECOV_FILELISTHEIGHT );
+ Border = TRUE;
+ SVLook = TRUE;
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_ROW8 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_NEXT
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_DOCRECOVERY_RECOVER:BTN_RECOV_NEXT";
+ Pos = MAP_APPFONT( RECOV_COL_C, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH*2, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Start Recovery >";
+ DefButton = TRUE;
+ };
+ String STR_RECOVERY_NEXT
+ {
+ Text[ en-US ] = "~Next >";
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( RECOV_COL_F, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+ Image IMG_GREENCHECK
+ {
+ ImageBitmap = Bitmap { File = "nu01.png"; };
+ };
+ Image IMG_GREENCHECK_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh01.png"; };
+ };
+ Image IMG_YELLOWCHECK
+ {
+ ImageBitmap = Bitmap { File = "nu04.png"; };
+ };
+ Image IMG_YELLOWCHECK_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh04.png"; };
+ };
+ Image IMG_REDCROSS
+ {
+ ImageBitmap = Bitmap { File = "nu02.png"; };
+ };
+ Image IMG_REDCROSS_HC
+ {
+ ImageBitmap = Bitmap { File = "nuh02.png"; };
+ };
+ String STR_SUCCESSRECOV
+ {
+ Text[ en-US ] = "Successfully recovered";
+ };
+ String STR_ORIGDOCRECOV
+ {
+ Text[ en-US ] = "Original document recovered";
+ };
+ String STR_RECOVFAILED
+ {
+ Text[ en-US ] = "Recovery failed";
+ };
+ String STR_RECOVINPROGR
+ {
+ Text[ en-US ] = "Recovery in progress";
+ };
+ String STR_NOTRECOVYET
+ {
+ Text[ en-US ] = "Not recovered yet";
+ };
+ String STR_RECOVERY_INPROGRESS
+ {
+ Text[ en-US ] = "%PRODUCTNAME %PRODUCTVERSION will start to recover your documents. Depending on the size of the documents this process can take some time." ;
+ };
+ String STR_RECOVERY_REPORT
+ {
+ Text[ en-US ] = "A report of the crash was created to help us identify the reason why %PRODUCTNAME crashed. Click 'Next' to get to the Error Report Tool or press 'Cancel' to skip this step." ;
+ };
+ String STR_RECOVERYONLY_FINISH_DESCR
+ {
+ Text[ en-US ] = "Recovery of your documents was finished.\nClick 'Finish' to see your documents.";
+ };
+ String STR_RECOVERYONLY_FINISH
+ {
+ Text[ en-US ] = "~Finish";
+ };
+};
+
+QueryBox RID_SVXQB_EXIT_RECOVERY
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "Are you sure you want to cancel the %PRODUCTNAME document recovery?";
+};
+
+ModalDialog RID_SVX_MDLG_DOCRECOVERY_BROKEN
+{
+ Size = MAP_APPFONT( BROKEN_WIDTH, BROKEN_HEIGHT );
+ HelpId = HID_SVX_MDLG_DOCRECOVERY_BROKEN;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text = "%PRODUCTNAME %PRODUCTVERSION";
+
+ FixedText FT_BROKEN_DESCR
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW0 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, (5*RSC_CD_FIXEDTEXT_HEIGHT) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "The automatic recovery process was interrupted.\n\nThe documents listed below will be saved in the folder noted below if you click 'Save'. Click 'Cancel' to close the wizard without saving the documents.";
+ };
+ FixedText FT_BROKEN_FILELIST
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW1 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Documents";
+ };
+ ListBox LB_BROKEN_FILELIST
+ {
+ HelpID = "svx:ListBox:RID_SVX_MDLG_DOCRECOVERY_BROKEN:LB_BROKEN_FILELIST";
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW2 );
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, (BROKEN_ROW3-BROKEN_ROW2) );
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ FixedText FT_BROKEN_SAVEDIR
+ {
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW4 + 1 ); // see ED_BROKEN_SAVEDIR
+ Size = MAP_APPFONT( BROKEN_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Save to";
+ };
+ Edit ED_BROKEN_SAVEDIR
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_DOCRECOVERY_BROKEN:ED_BROKEN_SAVEDIR";
+ Pos = MAP_APPFONT( BROKEN_COL0, BROKEN_ROW5 + 1 ); // center to pushbutton
+ Size = MAP_APPFONT( BROKEN_COL2 - BROKEN_COL0, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ PushButton BTN_BROKEN_SAVEDIR
+ {
+ HelpID = "svx:PushButton:RID_SVX_MDLG_DOCRECOVERY_BROKEN:BTN_BROKEN_SAVEDIR";
+ Pos = MAP_APPFONT( BROKEN_COL3, BROKEN_ROW5 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Chan~ge...";
+ };
+ FixedLine FL_BROKEN_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , BROKEN_ROW6 );
+ Size = MAP_APPFONT( BROKEN_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton BTN_BROKEN_OK
+ {
+ Pos = MAP_APPFONT( BROKEN_COL1, BROKEN_ROW7 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ Text [ en-US ] = "~Save";
+ };
+ CancelButton BTN_BROKEN_CANCEL
+ {
+ Pos = MAP_APPFONT( BROKEN_COL3, BROKEN_ROW7 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+TabPage RID_SVXPAGE_ERR_REP_WELCOME
+{
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_HEIGHT );
+ HelpId = HID_SVX_TP_ERR_REP_WELCOME;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW0 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Welcome to the %PRODUCTNAME %PRODUCTVERSION Error Report";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( RECOV_COL1, RECOV_ROW2 );
+ Size = MAP_APPFONT( RECOV_CONTROLWIDTH, (RECOV_ROW7-RECOV_ROW2-RSC_SP_CTRL_Y) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "This error report tool gathers information about how %PRODUCTNAME is working and sends it to Oracle to help improve future versions.\n\nIt's easy - just send the report without any further effort on your part by clicking 'Send' in the next dialog, or you can briefly describe how the error occurred and then click 'Send'. If you want to see the report, click the 'Show Report' button. No data will be sent if you click 'Do Not Send'.\n\nCustomer Privacy\nThe information gathered is limited to data concerning the state of %PRODUCTNAME %PRODUCTVERSION when the error occurred. Other information about passwords or document contents is not collected.\n\nThe information will only be used to improve the quality of %PRODUCTNAME and will not be shared with third parties.\nFor more information on Oracle's privacy policy, visit\nwww.oracle.com/html/services-privacy-policy.html";
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_ROW8 );
+ Size = MAP_APPFONT( RECOV_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_PREV
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_WELCOME:BTN_RECOV_PREV";
+ Pos = MAP_APPFONT( RECOV_COL_C, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "< ~Back";
+ };
+ OKButton BTN_RECOV_NEXT
+ {
+ Pos = MAP_APPFONT( RECOV_COL_D, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Next >";
+ DefButton = TRUE;
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( RECOV_COL_F, RECOV_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+TabPage RID_SVXPAGE_ERR_REP_SEND
+{
+ Size = MAP_APPFONT( ERRSEND_WIDTH, ERRSEND_HEIGHT );
+ HelpId = HID_SVX_TP_ERR_REP_SEND;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Hide = TRUE;
+ Window WIN_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , 0 );
+ Size = MAP_APPFONT( ERRSEND_WIDTH, RECOV_TITLEWINHEIGHT );
+ };
+ FixedText FT_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW0 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH1, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "Sending the Error Report";
+ };
+ FixedLine FL_RECOV_TITLE
+ {
+ Pos = MAP_APPFONT( 0 , RECOV_TITLEWINHEIGHT );
+ Size = MAP_APPFONT( RECOV_WIDTH, 2 );
+ };
+ FixedText FT_RECOV_DESCR
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW2 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, (ERRSEND_ROW3-ERRSEND_ROW2) );
+ WordBreak = TRUE;
+ Text[ en-US ] = "In the spaces below, you can enter a title for your error report and describe the action you were trying to carry out when the error occurred. Then click 'Send'.";
+ };
+
+ FixedText FT_ERRSEND_DOCTYPE
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW4 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, 2*RSC_CD_FIXEDTEXT_HEIGHT );
+ WordBreak = TRUE;
+ Text[ en-US ] = "~Which type of document (e.g. presentation) were you using when the error occurred?";
+ };
+ Edit ED_ERRSEND_DOCTYPE
+ {
+ HelpID = "svx:Edit:RID_SVXPAGE_ERR_REP_SEND:ED_ERRSEND_DOCTYPE";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW5 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ FixedText FT_ERRSEND_USING
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW7 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~How were you using %PRODUCTNAME when the error occurred? (optional)";
+ };
+ MultiLineEdit ML_ERRSEND_USING
+ {
+ HelpID = "svx:MultiLineEdit:RID_SVXPAGE_ERR_REP_SEND:ML_ERRSEND_USING";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW8 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, (ERRSEND_ROW12-ERRSEND_ROW8-RSC_SP_CTRL_Y) );
+ VScroll = TRUE;
+ IgnoreTab = TRUE;
+ Border = TRUE;
+ };
+ PushButton BTN_ERRSEND_SHOWREP
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_ERRSEND_SHOWREP";
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW8 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "Show ~Report";
+ };
+ PushButton BTN_ERRSEND_OPT
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_ERRSEND_OPT";
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW10 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "~Options...";
+ };
+ CheckBox CB_ERRSEND_CONTACT
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_ERR_REP_SEND:CB_ERRSEND_CONTACT";
+ Pos = MAP_APPFONT( ERRSEND_COL0, ERRSEND_ROW12 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH2, RSC_CD_CHECKBOX_HEIGHT );
+ Check = FALSE;
+ Text[ en-US ] = "~I allow Oracle to contact me regarding this report.";
+ };
+ FixedText FT_ERRSEND_EMAILADDR
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL1, ERRSEND_ROW13 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH3, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Please enter your e-mail address";
+ };
+ Edit ED_ERRSEND_EMAILADDR
+ {
+ HelpID = "svx:Edit:RID_SVXPAGE_ERR_REP_SEND:ED_ERRSEND_EMAILADDR";
+ Pos = MAP_APPFONT( ERRSEND_COL1, ERRSEND_ROW14 );
+ Size = MAP_APPFONT( ERRSEND_CONTROLWIDTH3, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+ FixedLine FL_RECOV_BOTTOM
+ {
+ Pos = MAP_APPFONT( 0 , ERRSEND_ROW15 );
+ Size = MAP_APPFONT( ERRSEND_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ PushButton BTN_RECOV_PREV
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_ERR_REP_SEND:BTN_RECOV_PREV";
+ Pos = MAP_APPFONT( ERRSEND_COL5, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "< ~Back";
+ };
+ OKButton BTN_RECOV_NEXT
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL6, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "S~end";
+ DefButton = TRUE;
+ };
+ CancelButton BTN_RECOV_CANCEL
+ {
+ Pos = MAP_APPFONT( ERRSEND_COL3, ERRSEND_ROW16 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text[ en-US ] = "Do ~Not Send";
+ };
+};
+
+ModalDialog RID_SVX_MDLG_ERR_REP_OPTIONS
+{
+ Size = MAP_APPFONT( ERROPT_WIDTH, ERROPT_HEIGHT );
+ HelpId = HID_SVX_MDLG_ERR_REP_OPTIONS;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Text[ en-US ] = "Options";
+
+ FixedLine FL_ERROPT_PROXY
+ {
+ Pos = MAP_APPFONT( ERROPT_COLA, ERROPT_ROW0 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLA, RSC_CD_FIXEDLINE_HEIGHT );
+ Text[ en-US ] = "Proxy settings";
+ };
+
+ RadioButton BTN_ERROPT_SYSTEM
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_SYSTEM";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW1 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~system settings";
+ };
+
+ RadioButton BTN_ERROPT_DIRECT
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_DIRECT";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW2 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~direct connection to the Internet";
+ };
+
+ RadioButton BTN_ERROPT_MANUAL
+ {
+ HelpID = "svx:RadioButton:RID_SVX_MDLG_ERR_REP_OPTIONS:BTN_ERROPT_MANUAL";
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW3 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, RSC_CD_RADIOBUTTON_HEIGHT );
+ Text[ en-US ] = "Use ~manual settings";
+ };
+
+ FixedText FT_ERROPT_PROXYSERVER
+ {
+ Pos = MAP_APPFONT( ERROPT_COLC, ERROPT_ROW4 );
+ Size = MAP_APPFONT( ERROPT_SERVER_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "HT~TP Proxy";
+ };
+
+ Edit ED_ERROPT_PROXYSERVER
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_ERR_REP_OPTIONS:ED_ERROPT_PROXYSERVER";
+ Pos = MAP_APPFONT( ERROPT_COLC, ERROPT_ROW5 );
+ Size = MAP_APPFONT( ERROPT_SERVER_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+
+ FixedText FT_ERROPT_PROXYPORT
+ {
+ Pos = MAP_APPFONT( ERROPT_COLC + ERROPT_SERVER_WIDTH + RSC_SP_CTRL_GROUP_X, ERROPT_ROW4 );
+ Size = MAP_APPFONT( ERROPT_PORT_WIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
+ Text[ en-US ] = "~Port";
+ };
+
+ Edit ED_ERROPT_PROXYPORT
+ {
+ HelpID = "svx:Edit:RID_SVX_MDLG_ERR_REP_OPTIONS:ED_ERROPT_PROXYPORT";
+ Pos = MAP_APPFONT( ERROPT_COLC + ERROPT_SERVER_WIDTH + RSC_SP_CTRL_GROUP_X, ERROPT_ROW5 );
+ Size = MAP_APPFONT( ERROPT_PORT_WIDTH, RSC_CD_TEXTBOX_HEIGHT );
+ Border = TRUE;
+ };
+
+ FixedText FT_ERROPT_DESCRIPTION
+ {
+ Pos = MAP_APPFONT( ERROPT_COLB, ERROPT_ROW6 );
+ Size = MAP_APPFONT( ERROPT_COLF - ERROPT_COLB, ERROPT_ROW7 - ERROPT_ROW6 );
+ WordBreak = TRUE;
+ Text[ en-US ] = "The %PRODUCTNAME Error Report tool needs to be connected to the Internet to be able to send error reports.\nCompanies often use proxy servers in conjunction with a firewall to protect the network.\nIf this applies to your situation, you have to specify the address and port for the server.";
+ };
+
+ FixedLine FL_ERROPT_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ERROPT_ROW8 );
+ Size = MAP_APPFONT( ERROPT_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+
+ OKButton BTN_ERROPT_OK
+ {
+ Pos = MAP_APPFONT( ERROPT_COLD, ERROPT_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+
+ CancelButton BTN_ERROPT_CANCEL
+ {
+ Pos = MAP_APPFONT( ERROPT_COLE, ERROPT_ROW9 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ };
+};
+
+
+ModalDialog RID_SVX_MDLG_ERR_REP_PREVIEW
+{
+ Size = MAP_APPFONT( ERRPREVIEW_WIDTH, ERRPREVIEW_HEIGHT );
+ HelpId = HID_SVX_MDLG_ERR_REP_PREVIEW;
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Moveable = TRUE;
+ Sizeable = TRUE;
+ Text[ en-US ] = "Error Report";
+
+ MultiLineEdit ML_ERRPREVIEW_CONTENT
+ {
+ HelpID = "svx:MultiLineEdit:RID_SVX_MDLG_ERR_REP_PREVIEW:ML_ERRPREVIEW_CONTENT";
+ Pos = MAP_APPFONT( ERRPREVIEW_COLA, ERRPREVIEW_ROW0 );
+ Size = MAP_APPFONT( ERRPREVIEW_COLC - ERRPREVIEW_COLA, ERRPREVIEW_ROW1 - ERRPREVIEW_ROW0 );
+ VScroll = TRUE;
+ HScroll = TRUE;
+ ReadOnly = TRUE;
+ Border = TRUE;
+ };
+
+ OKButton BTN_ERRPREVIEW_OK
+ {
+ Pos = MAP_APPFONT( ERRPREVIEW_COLB, ERRPREVIEW_ROW2 );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ DefButton = TRUE;
+ };
+}; \ No newline at end of file
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
new file mode 100644
index 000000000000..b1e7757c07f9
--- /dev/null
+++ b/svx/source/dialog/fntctrl.cxx
@@ -0,0 +1,851 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/viewsh.hxx> // SfxViewShell
+#include <sfx2/printer.hxx> // Printer
+#include <vcl/metric.hxx>
+#include <vcl/svapp.hxx>
+#include <unicode/uchar.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_XUB_STRLEN
+#include <svl/svstdarr.hxx>
+#endif
+#include <svtools/colorcfg.hxx>
+
+#include <svx/fntctrl.hxx>
+#include <svx/dialogs.hrc>
+#define TEXT_WIDTH 20
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using ::com::sun::star::i18n::XBreakIterator;
+
+// -----------------------------------------------------------------------
+// small helper functions to set fonts
+// -----------------------------------------------------------------------
+namespace
+{
+ void scaleFontWidth(Font& _rFont,const OutputDevice& rOutDev,long& _n100PercentFont)
+ {
+ _rFont.SetWidth( 0 );
+ _n100PercentFont = rOutDev.GetFontMetric( _rFont ).GetWidth();
+ }
+ // -----------------------------------------------------------------------
+ void initFont(Font& _rFont)
+ {
+ _rFont.SetTransparent(sal_True);
+ _rFont.SetAlign(ALIGN_BASELINE);
+ }
+ // -----------------------------------------------------------------------
+ void setFontSize(Font& _rFont)
+ {
+ Size aSize( _rFont.GetSize() );
+ aSize.Height() = ( aSize.Height() * 3 ) / 5;
+ aSize.Width() = ( aSize.Width() * 3 ) / 5;
+ _rFont.SetSize( aSize );
+ }
+ // -----------------------------------------------------------------------
+ void calcFontHeightAnyAscent(OutputDevice* _pWin,Font& _rFont,long& _nHeight,long& _nAscent)
+ {
+ if ( !_nHeight )
+ {
+ _pWin->SetFont( _rFont );
+ FontMetric aMetric( _pWin->GetFontMetric() );
+ _nHeight = aMetric.GetLineHeight();
+ _nAscent = aMetric.GetAscent();
+ }
+ }
+ // -----------------------------------------------------------------------
+ void setFont( const SvxFont& rNewFont, SvxFont& rImplFont )
+ {
+ rImplFont = rNewFont;
+ rImplFont.SetTransparent( sal_True );
+ rImplFont.SetAlign( ALIGN_BASELINE );
+ }
+
+}
+// -----------------------------------------------------------------------
+
+
+// class FontPrevWin_Impl -----------------------------------------------
+
+class FontPrevWin_Impl
+{
+ friend class SvxFontPrevWindow;
+
+ SvxFont aFont;
+ Printer* pPrinter;
+ sal_Bool bDelPrinter;
+
+ Reference < XBreakIterator > xBreak;
+ SvULongs aTextWidth;
+ SvXub_StrLens aScriptChg;
+ SvUShorts aScriptType;
+ SvxFont aCJKFont;
+ SvxFont aCTLFont;
+ String aText;
+ String aScriptText;
+ Color* pColor;
+ Color* pBackColor;
+ long nAscent;
+ sal_Unicode cStartBracket;
+ sal_Unicode cEndBracket;
+
+ long n100PercentFontWidth; // initial -1 -> not set yet
+ long n100PercentFontWidthCJK;
+ long n100PercentFontWidthCTL;
+ sal_uInt16 nFontWidthScale;
+
+ sal_Bool bSelection : 1,
+ bGetSelection : 1,
+ bUseResText : 1,
+ bTwoLines : 1,
+ bIsCJKUI : 1,
+ bIsCTLUI : 1,
+ bUseFontNameAsText : 1,
+ bTextInited : 1;
+
+ void _CheckScript();
+public:
+ inline FontPrevWin_Impl() :
+ pPrinter( NULL ), bDelPrinter( sal_False ),
+ pColor( NULL ), pBackColor( 0 ),
+ cStartBracket( 0 ), cEndBracket( 0 ), nFontWidthScale( 100 ),
+ bSelection( sal_False ), bGetSelection( sal_False ), bUseResText( sal_False ),
+ bTwoLines( sal_False ),
+ bIsCJKUI( sal_False ), bIsCTLUI( sal_False ),
+ bUseFontNameAsText( sal_False ), bTextInited( sal_False )
+ {
+ Invalidate100PercentFontWidth();
+ }
+
+ inline ~FontPrevWin_Impl()
+ {
+ delete pColor;
+ delete pBackColor;
+ if( bDelPrinter )
+ delete pPrinter;
+ }
+
+ void CheckScript();
+ Size CalcTextSize( OutputDevice* pWin, OutputDevice* pPrt, SvxFont &rFont );
+ void DrawPrev( OutputDevice* pWin, Printer* pPrt, Point &rPt, SvxFont &rFont );
+
+ sal_Bool SetFontWidthScale( sal_uInt16 nScaleInPercent );
+ inline void Invalidate100PercentFontWidth();
+ inline sal_Bool Is100PercentFontWidthValid() const;
+ void ScaleFontWidth( const OutputDevice& rOutDev );
+ // scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
+ // sets the 100%-Font-Widths
+};
+
+void FontPrevWin_Impl::CheckScript()
+{
+ if( aText != aScriptText )
+ _CheckScript();
+}
+
+inline void FontPrevWin_Impl::Invalidate100PercentFontWidth()
+{
+ n100PercentFontWidth = n100PercentFontWidthCJK = n100PercentFontWidthCTL = -1;
+}
+
+inline sal_Bool FontPrevWin_Impl::Is100PercentFontWidthValid() const
+{
+ DBG_ASSERT( ( n100PercentFontWidth == -1 && n100PercentFontWidthCJK == -1 ) ||
+ ( n100PercentFontWidth != -1 && n100PercentFontWidthCJK != -1 ) ||
+ ( n100PercentFontWidth == -1 && n100PercentFontWidthCTL == -1 ) ||
+ ( n100PercentFontWidth != -1 && n100PercentFontWidthCTL != -1 ),
+ "*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous" );
+ return n100PercentFontWidth != -1;
+}
+
+// class FontPrevWin_Impl -----------------------------------------------
+
+/*-----------------19.7.2001 08:44------------------
+ * void FontPrevWin_Impl::_CheckScript()
+ * evalutates the scripttypes of the actual string.
+ * Afterwards the positions of script change are notified in aScriptChg,
+ * the scripttypes in aScriptType.
+ * The aTextWidth array will be filled with zero.
+ * --------------------------------------------------*/
+
+void FontPrevWin_Impl::_CheckScript()
+{
+ aScriptText = aText;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ aScriptChg.clear();
+ aScriptType.Remove( 0, nCnt );
+ aTextWidth.Remove( 0, nCnt );
+ nCnt = 0;
+ }
+ if( !xBreak.is() )
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ xBreak = Reference< XBreakIterator >(xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),UNO_QUERY);
+ }
+ if( xBreak.is() )
+ {
+ sal_uInt16 nScript = xBreak->getScriptType( aText, 0 );
+ sal_uInt16 nChg = 0;
+ if( com::sun::star::i18n::ScriptType::WEAK == nScript )
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript );
+ if( nChg < aText.Len() )
+ nScript = xBreak->getScriptType( aText, nChg );
+ else
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+
+ do
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript );
+ if (nChg < aText.Len() && nChg > 0 &&
+ (com::sun::star::i18n::ScriptType::WEAK ==
+ xBreak->getScriptType(aText, nChg - 1)))
+ {
+ int8_t nType = u_charType(aText.GetChar(nChg) );
+ if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK ||
+ nType == U_COMBINING_SPACING_MARK )
+ {
+ aScriptChg.push_back( nChg - 1 );
+ }
+ else
+ {
+ aScriptChg.push_back( nChg );
+ }
+ }
+ else
+ {
+ aScriptChg.push_back( nChg );
+ }
+ aScriptType.Insert( nScript, nCnt );
+ aTextWidth.Insert( sal_uIntPtr(0), nCnt++ );
+
+ if( nChg < aText.Len() )
+ nScript = xBreak->getScriptType( aText, nChg );
+ else
+ break;
+ } while( sal_True );
+ }
+}
+
+/*-----------------19.7.2001 08:48------------------
+ * Size FontPrevWin_Impl::CalcTextSize(..)
+ * fills the aTextWidth array with the text width of every part
+ * of the actual string without a script change inside.
+ * For Latin parts the given rFont will be used,
+ * for Asian parts the aCJKFont.
+ * The returned size contains the whole string.
+ * The member nAscent is calculated to the maximal ascent of all used fonts.
+ * --------------------------------------------------*/
+
+Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter,
+ SvxFont &rFont )
+{
+ sal_uInt16 nScript;
+ sal_uInt16 nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = aText.Len();
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+ long nTxtWidth = 0;
+ long nCJKHeight = 0;
+ long nCTLHeight = 0;
+ long nHeight = 0;
+ nAscent = 0;
+ long nCJKAscent = 0;
+ long nCTLAscent = 0;
+ do
+ {
+ SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ sal_uIntPtr nWidth = rFnt.GetTxtSize( _pPrinter, aText, nStart, nEnd-nStart ).
+ Width();
+ aTextWidth[ nIdx++ ] = nWidth;
+ nTxtWidth += nWidth;
+ switch(nScript)
+ {
+ case com::sun::star::i18n::ScriptType::ASIAN:
+ calcFontHeightAnyAscent(pWin,aCJKFont,nCJKHeight,nCJKAscent);
+ break;
+ case com::sun::star::i18n::ScriptType::COMPLEX:
+ calcFontHeightAnyAscent(pWin,aCTLFont,nCTLHeight,nCTLAscent);
+ break;
+ default:
+ calcFontHeightAnyAscent(pWin,rFont,nHeight,nAscent);
+ }
+
+ if( nEnd < aText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( sal_True );
+ nHeight -= nAscent;
+ nCJKHeight -= nCJKAscent;
+ nCTLHeight -= nCTLAscent;
+ if( nHeight < nCJKHeight )
+ nHeight = nCJKHeight;
+ if( nAscent < nCJKAscent )
+ nAscent = nCJKAscent;
+ if( nHeight < nCTLHeight )
+ nHeight = nCTLHeight;
+ if( nAscent < nCTLAscent )
+ nAscent = nCTLAscent;
+ nHeight += nAscent;
+
+ Size aTxtSize( nTxtWidth, nHeight );
+ return aTxtSize;
+}
+
+/*-----------------19.7.2001 08:54------------------
+ * void FontPrevWin_Impl::DrawPrev(..)
+ * calls SvxFont::DrawPrev(..) for every part of the string without a script
+ * change inside, for Asian parts the aCJKFont will be used, otherwise the
+ * given rFont.
+ * --------------------------------------------------*/
+
+void FontPrevWin_Impl::DrawPrev( OutputDevice* pWin, Printer* _pPrinter,
+ Point &rPt, SvxFont &rFont )
+{
+ Font aOldFont = _pPrinter->GetFont();
+ sal_uInt16 nScript;
+ sal_uInt16 nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = aScriptChg.size();
+ if( nCnt )
+ {
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = aText.Len();
+ nScript = com::sun::star::i18n::ScriptType::LATIN;
+ }
+ do
+ {
+ SvxFont& rFnt = (nScript==com::sun::star::i18n::ScriptType::ASIAN) ? aCJKFont : ((nScript==com::sun::star::i18n::ScriptType::COMPLEX) ? aCTLFont : rFont);
+ _pPrinter->SetFont( rFnt );
+
+ rFnt.DrawPrev( pWin, _pPrinter, rPt, aText, nStart, nEnd - nStart );
+
+ rPt.X() += aTextWidth[ nIdx++ ];
+ if( nEnd < aText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = aScriptChg[ nIdx ];
+ nScript = aScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( sal_True );
+ _pPrinter->SetFont( aOldFont );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool FontPrevWin_Impl::SetFontWidthScale( sal_uInt16 nScale )
+{
+ if( nFontWidthScale != nScale )
+ {
+ nFontWidthScale = nScale;
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+
+// -----------------------------------------------------------------------
+
+void FontPrevWin_Impl::ScaleFontWidth( const OutputDevice& rOutDev )
+{
+ if( !Is100PercentFontWidthValid() )
+ {
+ scaleFontWidth(aFont,rOutDev,n100PercentFontWidth);
+ scaleFontWidth(aCJKFont,rOutDev,n100PercentFontWidthCJK);
+ scaleFontWidth(aCTLFont,rOutDev,n100PercentFontWidthCTL);
+ }
+
+ aFont.SetWidth( n100PercentFontWidth * nFontWidthScale / 100 );
+ aCJKFont.SetWidth( n100PercentFontWidthCJK * nFontWidthScale / 100 );
+ aCTLFont.SetWidth( n100PercentFontWidthCTL * nFontWidthScale / 100 );
+}
+
+// class SvxFontPrevWindow -----------------------------------------------
+
+void SvxFontPrevWindow::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
+{
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+ if ( bForeground )
+ {
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( rStyleSettings.GetWindowColor() );
+ }
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontPrevWindow::SvxFontPrevWindow( Window* pParent, const ResId& rId ) :
+
+ Window ( pParent, rId )
+{
+ pImpl = new FontPrevWin_Impl;
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( pSh )
+ pImpl->pPrinter = pSh->GetPrinter();
+
+ if ( !pImpl->pPrinter )
+ {
+ pImpl->pPrinter = new Printer;
+ pImpl->bDelPrinter = sal_True;
+ }
+ SetMapMode( MapMode( MAP_TWIP ) );
+ initFont(pImpl->aFont);
+ initFont(pImpl->aCJKFont);
+ initFont(pImpl->aCTLFont);
+ InitSettings( sal_True, sal_True );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+
+ LanguageType eLanguage = Application::GetSettings().GetUILanguage();
+ switch( eLanguage )
+ {
+ case LANGUAGE_CHINESE:
+ case LANGUAGE_JAPANESE:
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ case LANGUAGE_CHINESE_SIMPLIFIED:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_SINGAPORE:
+ case LANGUAGE_CHINESE_MACAU:
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ pImpl->bIsCJKUI = sal_True;
+ break;
+ // TODO: CTL Locale
+ // pImpl->bIsCTLUI = sal_True;
+ // break;
+ default:
+ pImpl->bIsCJKUI = pImpl->bIsCTLUI = sal_False;
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxFontPrevWindow::~SvxFontPrevWindow()
+{
+ delete pImpl;
+}
+
+// -----------------------------------------------------------------------
+SvxFont& SvxFontPrevWindow::GetCTLFont()
+{
+ return pImpl->aCTLFont;
+}
+
+// -----------------------------------------------------------------------
+
+SvxFont& SvxFontPrevWindow::GetCJKFont()
+{
+ return pImpl->aCJKFont;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ InitSettings( sal_True, sal_False );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ InitSettings( sal_False, sal_True );
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitSettings( sal_True, sal_True );
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+SvxFont& SvxFontPrevWindow::GetFont()
+{
+ pImpl->Invalidate100PercentFontWidth(); // because the user might change the size
+ return pImpl->aFont;
+}
+
+const SvxFont& SvxFontPrevWindow::GetFont() const
+{
+ return pImpl->aFont;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetPreviewText( const ::rtl::OUString& rString )
+{
+ pImpl->aText = rString;
+ pImpl->bTextInited = sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFontNameAsPreviewText()
+{
+ pImpl->bUseFontNameAsText = sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFont( const SvxFont& rOutFont )
+{
+ setFont( rOutFont, pImpl->aFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFont( const SvxFont& rNormalOutFont, const SvxFont& rCJKOutFont, const SvxFont& rCTLFont )
+{
+ setFont( rNormalOutFont, pImpl->aFont );
+ setFont( rCJKOutFont, pImpl->aCJKFont );
+ setFont( rCTLFont, pImpl->aCTLFont );
+
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetCJKFont( const SvxFont &rCJKOutFont )
+{
+ setFont( rCJKOutFont, pImpl->aCJKFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+// -----------------------------------------------------------------------------
+void SvxFontPrevWindow::SetCTLFont( const SvxFont &rCTLOutFont )
+{
+ setFont( rCTLOutFont, pImpl->aCTLFont );
+
+ pImpl->Invalidate100PercentFontWidth();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetColor(const Color &rColor)
+{
+ delete pImpl->pColor;
+ pImpl->pColor = new Color( rColor );
+ Invalidate();
+}
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::ResetColor()
+{
+ delete pImpl->pColor;
+ pImpl->pColor = 0;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetBackColor(const Color &rColor)
+{
+ delete pImpl->pBackColor;
+ pImpl->pBackColor = new Color( rColor );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::UseResourceText( sal_Bool bUse )
+{
+ pImpl->bUseResText = bUse;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::Paint( const Rectangle& )
+{
+ Printer* pPrinter = pImpl->pPrinter;
+ SvxFont& rFont = pImpl->aFont;
+ SvxFont& rCJKFont = pImpl->aCJKFont;
+ // TODO: SvxFont& rCTLFont = pImpl->aCTLFont;
+
+ if ( pImpl->bUseResText )
+ pImpl->aText = GetText();
+ else if ( !pImpl->bSelection && !pImpl->bTextInited )
+ {
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( pSh && !pImpl->bGetSelection && !pImpl->bUseFontNameAsText )
+ {
+ pImpl->aText = pSh->GetSelectionText();
+ pImpl->bGetSelection = sal_True;
+ pImpl->bSelection = pImpl->aText.Len() != 0;
+
+ }
+
+ if ( !pImpl->bSelection || pImpl->bUseFontNameAsText )
+ {
+ pImpl->aText = rFont.GetName();
+ if( pImpl->bIsCJKUI )
+ pImpl->aText += rCJKFont.GetName();
+ //TODO bIsCTLUI
+ }
+
+ if ( !pImpl->aText.Len() )
+ pImpl->aText = GetText();
+
+ // remove line feeds and carriage returns from string
+ bool bNotEmpty = false;
+ for ( xub_StrLen i = 0; i < pImpl->aText.Len(); ++i )
+ {
+ if ( 0xa == pImpl->aText.GetChar( i ) ||
+ 0xd == pImpl->aText.GetChar( i ) )
+ pImpl->aText.SetChar( i, ' ' );
+ else
+ bNotEmpty = true;
+ }
+ if ( !bNotEmpty )
+ pImpl->aText = GetText();
+
+ if ( pImpl->aText.Len() > (TEXT_WIDTH-1) )
+ pImpl->aText.Erase( pImpl->aText.Search( sal_Unicode( ' ' ), TEXT_WIDTH ) );
+ }
+
+ // calculate text width scaling
+ pImpl->ScaleFontWidth( *this/*, rFont*/ );
+
+ pImpl->CheckScript();
+ Size aTxtSize = pImpl->CalcTextSize( this, pPrinter, rFont );
+
+ const Size aLogSize( GetOutputSize() );
+
+ long nX = aLogSize.Width() / 2 - aTxtSize.Width() / 2;
+ long nY = aLogSize.Height() / 2 - aTxtSize.Height() / 2;
+
+ if ( nY + pImpl->nAscent > aLogSize.Height() )
+ nY = aLogSize.Height() - pImpl->nAscent;
+
+ if ( pImpl->pBackColor )
+ {
+ Rectangle aRect( Point( 0, 0 ), aLogSize );
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( *pImpl->pBackColor );
+ DrawRect( aRect );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+ if ( pImpl->pColor )
+ {
+ Rectangle aRect( Point( nX, nY ), aTxtSize );
+ Color aLineCol = GetLineColor();
+ Color aFillCol = GetFillColor();
+ SetLineColor();
+ SetFillColor( *pImpl->pColor );
+ DrawRect( aRect );
+ SetLineColor( aLineCol );
+ SetFillColor( aFillCol );
+ }
+
+ long nStdAscent = pImpl->nAscent;
+ nY += nStdAscent;
+
+ if(pImpl->bTwoLines)
+ {
+ SvxFont aSmallFont( rFont );
+ Size aOldSize = pImpl->aCJKFont.GetSize();
+ setFontSize(aSmallFont);
+ setFontSize(pImpl->aCJKFont);
+
+ long nStartBracketWidth = 0;
+ long nEndBracketWidth = 0;
+ long nTextWidth = 0;
+ if(pImpl->cStartBracket)
+ {
+ String sBracket(pImpl->cStartBracket);
+ nStartBracketWidth = rFont.GetTxtSize( pPrinter, sBracket ).Width();
+ }
+ if(pImpl->cEndBracket)
+ {
+ String sBracket(pImpl->cEndBracket);
+ nEndBracketWidth = rFont.GetTxtSize( pPrinter, sBracket ).Width();
+ }
+ nTextWidth = pImpl->CalcTextSize( this, pPrinter, aSmallFont ).Width();
+ long nResultWidth = nStartBracketWidth;
+ nResultWidth += nEndBracketWidth;
+ nResultWidth += nTextWidth;
+
+ long _nX = (aLogSize.Width() - nResultWidth) / 2;
+ DrawLine( Point( 0, nY ), Point( _nX, nY ) );
+ DrawLine( Point( _nX + nResultWidth, nY ), Point( aLogSize.Width(), nY ) );
+
+ long nSmallAscent = pImpl->nAscent;
+ long nOffset = (nStdAscent - nSmallAscent ) / 2;
+
+ if(pImpl->cStartBracket)
+ {
+ String sBracket(pImpl->cStartBracket);
+ rFont.DrawPrev( this, pPrinter, Point( _nX, nY - nOffset - 4), sBracket );
+ _nX += nStartBracketWidth;
+ }
+
+ Point aTmpPoint1( _nX, nY - nSmallAscent - 2 );
+ Point aTmpPoint2( _nX, nY );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint1, aSmallFont );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint2, aSmallFont );
+
+ _nX += nTextWidth;
+ if(pImpl->cEndBracket)
+ {
+ Point aTmpPoint( _nX + 1, nY - nOffset - 4);
+ String sBracket(pImpl->cEndBracket);
+ rFont.DrawPrev( this, pPrinter, aTmpPoint, sBracket );
+ }
+ pImpl->aCJKFont.SetSize( aOldSize );
+ }
+ else
+ {
+ Color aLineCol = GetLineColor();
+
+ SetLineColor( rFont.GetColor() );
+ DrawLine( Point( 0, nY ), Point( nX, nY ) );
+ DrawLine( Point( nX + aTxtSize.Width(), nY ), Point( aLogSize.Width(), nY ) );
+
+ SetLineColor( aLineCol );
+
+ Point aTmpPoint( nX, nY );
+ pImpl->DrawPrev( this, pPrinter, aTmpPoint, rFont );
+ }
+}
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxFontPrevWindow::IsTwoLines() const
+{
+ return pImpl->bTwoLines;
+}
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontPrevWindow::SetTwoLines(sal_Bool bSet)
+{
+ pImpl->bTwoLines = bSet;}
+
+/* -----------------------------04.12.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontPrevWindow::SetBrackets(sal_Unicode cStart, sal_Unicode cEnd)
+{
+ pImpl->cStartBracket = cStart;
+ pImpl->cEndBracket = cEnd;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::SetFontWidthScale( sal_uInt16 n )
+{
+ if( pImpl->SetFontWidthScale( n ) )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SvxFontPrevWindow::AutoCorrectFontColor( void )
+{
+ Color aFontColor( GetTextColor() );
+
+ if( COL_AUTO == pImpl->aFont.GetColor().GetColor() )
+ pImpl->aFont.SetColor( aFontColor );
+
+ if( COL_AUTO == pImpl->aCJKFont.GetColor().GetColor() )
+ pImpl->aCJKFont.SetColor( aFontColor );
+
+ if( COL_AUTO == pImpl->aCTLFont.GetColor().GetColor() )
+ pImpl->aCTLFont.SetColor( aFontColor );
+}
diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx
new file mode 100644
index 000000000000..984d7dca4af4
--- /dev/null
+++ b/svx/source/dialog/fontlb.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/fontlb.hxx"
+#include <vcl/svapp.hxx>
+
+// ============================================================================
+
+DBG_NAME( SvLBoxFontString );
+
+SvLBoxFontString::SvLBoxFontString() :
+ SvLBoxString()
+{
+ DBG_CTOR( SvLBoxFontString, 0 );
+}
+
+SvLBoxFontString::SvLBoxFontString(
+ SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rString,
+ const Font& rFont, const Color* pColor ) :
+ SvLBoxString( pEntry, nFlags, rString ),
+ maFont( rFont ),
+ mbUseColor( pColor != NULL )
+{
+ DBG_CTOR( SvLBoxFontString, 0 );
+ SetText( pEntry, rString );
+ if( pColor )
+ maFont.SetColor( *pColor );
+}
+
+SvLBoxFontString::~SvLBoxFontString()
+{
+ DBG_DTOR( SvLBoxFontString, 0 );
+}
+
+
+SvLBoxItem* SvLBoxFontString::Create() const
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ return new SvLBoxFontString;
+}
+
+void SvLBoxFontString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ Font aOldFont( rDev.GetFont() );
+ Font aNewFont( maFont );
+ bool bSel = (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
+// if( !mbUseColor ) // selection gets font color, if available
+ if( !mbUseColor || bSel ) // selection always gets highlight color
+ {
+ const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
+ aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() );
+ }
+
+ rDev.SetFont( aNewFont );
+ SvLBoxString::Paint( rPos, rDev, nFlags, pEntry );
+ rDev.SetFont( aOldFont );
+}
+
+void SvLBoxFontString::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
+{
+ DBG_CHKTHIS( SvLBoxFontString, 0 );
+ Font aOldFont( pView->GetFont() );
+ pView->SetFont( maFont );
+ SvLBoxString::InitViewData( pView, pEntry, pViewData);
+ pView->SetFont( aOldFont );
+}
+
+
+// ============================================================================
+
+SvxFontListBox::SvxFontListBox( Window* pParent, const ResId& rResId ) :
+ SvTabListBox( pParent, rResId ),
+ maStdFont( GetFont() ),
+ mbUseFont( false )
+{
+ maStdFont.SetTransparent( sal_True );
+ maEntryFont = maStdFont;
+}
+
+void SvxFontListBox::InsertFontEntry( const String& rString, const Font& rFont, const Color* pColor )
+{
+ mbUseFont = true; // InitEntry() will use maEntryFont
+ maEntryFont = rFont; // font to use in InitEntry() over InsertEntry()
+ mpEntryColor = pColor; // color to use in InitEntry() over InsertEntry()
+ InsertEntry( rString );
+ mbUseFont = false;
+}
+
+void SvxFontListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
+{
+ SvLBoxEntry* pEntry = GetEntry( nPos );
+ if( pEntry )
+ {
+ Select( pEntry, bSelect );
+ ShowEntry( pEntry );
+ }
+}
+
+void SvxFontListBox::SetNoSelection()
+{
+ SelectAll( sal_False, sal_True );
+}
+
+sal_uLong SvxFontListBox::GetSelectEntryPos() const
+{
+ SvLBoxEntry* pSvLBoxEntry = FirstSelected();
+ return pSvLBoxEntry ? GetModel()->GetAbsPos( pSvLBoxEntry ) : LIST_APPEND;
+}
+
+XubString SvxFontListBox::GetSelectEntry() const
+{
+ return GetEntryText( GetSelectEntryPos() );
+}
+
+void SvxFontListBox::InitEntry(
+ SvLBoxEntry* pEntry, const XubString& rEntryText,
+ const Image& rCollImg, const Image& rExpImg,
+ SvLBoxButtonKind eButtonKind )
+{
+ if( mbUseFont )
+ {
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0,
+ pCheckButtonData ) );
+ pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, rCollImg, rExpImg, SVLISTENTRYFLAG_EXPANDED ) );
+ pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) );
+ }
+ else
+ SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg,
+ eButtonKind );
+}
+
+#if ENABLE_LAYOUT
+
+namespace layout
+{
+
+SvxFontListBox::~SvxFontListBox ()
+{
+}
+
+sal_uInt16 SvxFontListBox::InsertFontEntry (String const& entry, Font const&, Color const*)
+{
+ return InsertEntry (entry);
+}
+
+SvxFontListBox::SvxFontListBox( Context* pParent, const char* pFile)
+: ListBox( pParent, pFile )
+{
+}
+
+/*IMPL_IMPL (SvxFontListBox, ListBox);
+IMPL_CONSTRUCTORS (SvxFontListBox, ListBox, "svxfontlistbox");
+IMPL_GET_IMPL (SvxFontListBox);
+IMPL_GET_WINDOW (SvxFontListBox);*/
+
+};
+
+#endif
+
+// ============================================================================
+
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx
new file mode 100644
index 000000000000..ae2eb6c04098
--- /dev/null
+++ b/svx/source/dialog/fontwork.cxx
@@ -0,0 +1,1283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/module.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/shl.hxx>
+
+#define _SVX_FONTWORK_CXX
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/xtextit.hxx>
+
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+#include <svx/dialogs.hrc>
+#include "fontwork.hrc"
+#include <svx/fontwork.hxx>
+#include <editeng/outlobj.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+
+SFX_IMPL_DOCKINGWINDOW( SvxFontWorkChildWindow, SID_FONTWORK );
+
+/*************************************************************************
+|*
+|* ControllerItem fuer Fontwork
+|*
+\************************************************************************/
+
+SvxFontWorkControllerItem::SvxFontWorkControllerItem
+(
+ sal_uInt16 _nId,
+ SvxFontWorkDialog& rDlg,
+ SfxBindings& rBindings
+) :
+
+ SfxControllerItem( _nId, rBindings ),
+
+ rFontWorkDlg( rDlg )
+{
+}
+
+/*************************************************************************
+|*
+|* StateChanged-Methode fuer FontWork-Items
+|*
+\************************************************************************/
+
+void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ switch ( GetId() )
+ {
+ case SID_FORMTEXT_STYLE:
+ {
+ const XFormTextStyleItem* pStateItem =
+ PTR_CAST(XFormTextStyleItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStyleItem erwartet");
+ rFontWorkDlg.SetStyle_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_ADJUST:
+ {
+ const XFormTextAdjustItem* pStateItem =
+ PTR_CAST(XFormTextAdjustItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextAdjustItem erwartet");
+ rFontWorkDlg.SetAdjust_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_DISTANCE:
+ {
+ const XFormTextDistanceItem* pStateItem =
+ PTR_CAST(XFormTextDistanceItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextDistanceItem erwartet");
+ rFontWorkDlg.SetDistance_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_START:
+ {
+ const XFormTextStartItem* pStateItem =
+ PTR_CAST(XFormTextStartItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStartItem erwartet");
+ rFontWorkDlg.SetStart_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_MIRROR:
+ {
+ const XFormTextMirrorItem* pStateItem =
+ PTR_CAST(XFormTextMirrorItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextMirrorItem erwartet");
+ rFontWorkDlg.SetMirror_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_STDFORM:
+ {
+ const XFormTextStdFormItem* pStateItem =
+ PTR_CAST(XFormTextStdFormItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStdFormItem erwartet");
+ rFontWorkDlg.SetStdForm_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_HIDEFORM:
+ {
+ const XFormTextHideFormItem* pStateItem =
+ PTR_CAST(XFormTextHideFormItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextHideFormItem erwartet");
+ rFontWorkDlg.SetShowForm_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_OUTLINE:
+ {
+ const XFormTextOutlineItem* pStateItem =
+ PTR_CAST(XFormTextOutlineItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextOutlineItem erwartet");
+ rFontWorkDlg.SetOutline_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHADOW:
+ {
+ const XFormTextShadowItem* pStateItem =
+ PTR_CAST(XFormTextShadowItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowItem erwartet");
+ rFontWorkDlg.SetShadow_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWCOLOR:
+ {
+ const XFormTextShadowColorItem* pStateItem =
+ PTR_CAST(XFormTextShadowColorItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowColorItem erwartet");
+ rFontWorkDlg.SetShadowColor_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWXVAL:
+ {
+ const XFormTextShadowXValItem* pStateItem =
+ PTR_CAST(XFormTextShadowXValItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowXValItem erwartet");
+ rFontWorkDlg.SetShadowXVal_Impl(pStateItem);
+ break;
+ }
+ case SID_FORMTEXT_SHDWYVAL:
+ {
+ const XFormTextShadowYValItem* pStateItem =
+ PTR_CAST(XFormTextShadowYValItem, pItem);
+ DBG_ASSERT(pStateItem || pItem == 0, "XFormTextShadowYValItem erwartet");
+ rFontWorkDlg.SetShadowYVal_Impl(pStateItem);
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Ableitung vom SfxChildWindow als "Behaelter" fuer Fontwork-Dialog
+|*
+\************************************************************************/
+
+SvxFontWorkChildWindow::SvxFontWorkChildWindow
+(
+ Window* _pParent,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo
+) :
+
+ SfxChildWindow( _pParent, nId )
+
+{
+ pWindow = new SvxFontWorkDialog( pBindings, this, _pParent,
+ SVX_RES( RID_SVXDLG_FONTWORK ) );
+ SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*) pWindow;
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+/*************************************************************************
+|*
+|* Floating Window zur Attributierung von Texteffekten
+|*
+\************************************************************************/
+
+SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx,
+ SfxChildWindow *pCW,
+ Window* _pParent,
+ const ResId& rResId ) :
+ SfxDockingWindow( pBindinx, pCW, _pParent, rResId ),
+
+ aFormSet (this, ResId(VS_FORMS,*rResId.GetResMgr())),
+
+ aTbxStyle (this, ResId(TBX_STYLE,*rResId.GetResMgr())),
+ aTbxAdjust (this, ResId(TBX_ADJUST,*rResId.GetResMgr())),
+
+ aFbDistance (this, ResId(FB_DISTANCE,*rResId.GetResMgr())),
+ aMtrFldDistance (this, ResId(MTR_FLD_DISTANCE,*rResId.GetResMgr())),
+ aFbTextStart (this, ResId(FB_TEXTSTART,*rResId.GetResMgr())),
+ aMtrFldTextStart(this, ResId(MTR_FLD_TEXTSTART,*rResId.GetResMgr())),
+
+ aTbxShadow (this, ResId(TBX_SHADOW,*rResId.GetResMgr())),
+
+ aFbShadowX (this, ResId(FB_SHADOW_X,*rResId.GetResMgr())),
+ aMtrFldShadowX (this, ResId(MTR_FLD_SHADOW_X,*rResId.GetResMgr())),
+ aFbShadowY (this, ResId(FB_SHADOW_Y,*rResId.GetResMgr())),
+ aMtrFldShadowY (this, ResId(MTR_FLD_SHADOW_Y,*rResId.GetResMgr())),
+
+ aShadowColorLB (this, ResId(CLB_SHADOW_COLOR,*rResId.GetResMgr())),
+ rBindings (*pBindinx),
+
+ nLastStyleTbxId(0),
+ nLastAdjustTbxId(0),
+ nLastShadowTbxId(0),
+ nSaveShadowX (0),
+ nSaveShadowY (0),
+ nSaveShadowAngle(450),
+ nSaveShadowSize (100),
+
+ maImageList (ResId(IL_FONTWORK,*rResId.GetResMgr())),
+ maImageListH (ResId(ILH_FONTWORK,*rResId.GetResMgr())),
+
+ pColorTable (NULL)
+{
+ FreeResource();
+
+ ApplyImageList();
+
+ pCtrlItems[0] = new SvxFontWorkControllerItem(SID_FORMTEXT_STYLE, *this, rBindings);
+ pCtrlItems[1] = new SvxFontWorkControllerItem(SID_FORMTEXT_ADJUST, *this, rBindings);
+ pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings);
+ pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings);
+ pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings);
+ pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_STDFORM, *this, rBindings);
+ pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings);
+ pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings);
+ pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings);
+ pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings);
+ pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings);
+ pCtrlItems[11] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings);
+
+ WinBits aNewStyle = ( aFormSet.GetStyle() | WB_VSCROLL | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ aFormSet.SetStyle( aNewStyle );
+
+ Size aSize = aTbxStyle.CalcWindowSizePixel();
+ aTbxStyle.SetSizePixel(aSize);
+ aTbxStyle.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectStyleHdl_Impl) );
+
+ aTbxAdjust.SetSizePixel(aSize);
+ aTbxAdjust.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectAdjustHdl_Impl) );
+
+ aTbxShadow.SetSizePixel(aSize);
+ aTbxShadow.SetSelectHdl( LINK(this, SvxFontWorkDialog, SelectShadowHdl_Impl) );
+
+// aFbShadowX.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_XDIST)));
+// aFbShadowY.SetBitmap(Bitmap(FW_RESID(RID_SVXBMP_SHADOW_YDIST)));
+
+ Link aLink = LINK(this, SvxFontWorkDialog, ModifyInputHdl_Impl);
+ aMtrFldDistance.SetModifyHdl( aLink );
+ aMtrFldTextStart.SetModifyHdl( aLink );
+ aMtrFldShadowX.SetModifyHdl( aLink );
+ aMtrFldShadowY.SetModifyHdl( aLink );
+
+ // System-Metrik setzen
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+ SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
+ if( eDlgUnit == FUNIT_MM )
+ {
+ aMtrFldDistance.SetSpinSize( 50 );
+ aMtrFldTextStart.SetSpinSize( 50 );
+ aMtrFldShadowX.SetSpinSize( 50 );
+ aMtrFldShadowY.SetSpinSize( 50 );
+ }
+ else
+ {
+ aMtrFldDistance.SetSpinSize( 10 );
+ aMtrFldTextStart.SetSpinSize( 10 );
+ aMtrFldShadowX.SetSpinSize( 10 );
+ aMtrFldShadowY.SetSpinSize( 10 );
+ }
+
+ aShadowColorLB.SetSelectHdl( LINK(this, SvxFontWorkDialog, ColorSelectHdl_Impl) );
+
+ aInputTimer.SetTimeout(500);
+ aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl));
+
+ aFormSet.SetSelectHdl( LINK(this, SvxFontWorkDialog, FormSelectHdl_Impl) );
+ aFormSet.SetColCount(4);
+ aFormSet.SetLineCount(2);
+
+ Bitmap aBmp(SVX_RES(RID_SVXBMP_FONTWORK_FORM1));
+ aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
+ aFormSet.SetSizePixel(aSize);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SvxFontWorkDialog::~SvxFontWorkDialog()
+{
+ for (sal_uInt16 i = 0; i < CONTROLLER_COUNT; i++)
+ DELETEZ(pCtrlItems[i]);
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::Zoom()
+{
+ SfxDockingWindow::Roll();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SfxChildAlignment SvxFontWorkDialog::CheckAlignment( SfxChildAlignment eActAlign,
+ SfxChildAlignment eAlign )
+{
+ SfxChildAlignment eAlignment;
+
+ switch ( eAlign )
+ {
+ case SFX_ALIGN_TOP:
+ case SFX_ALIGN_HIGHESTTOP:
+ case SFX_ALIGN_LOWESTTOP:
+ case SFX_ALIGN_BOTTOM:
+ case SFX_ALIGN_LOWESTBOTTOM:
+ case SFX_ALIGN_HIGHESTBOTTOM:
+ {
+ eAlignment = eActAlign;
+ }
+ break;
+
+ case SFX_ALIGN_LEFT:
+ case SFX_ALIGN_RIGHT:
+ case SFX_ALIGN_FIRSTLEFT:
+ case SFX_ALIGN_LASTLEFT:
+ case SFX_ALIGN_FIRSTRIGHT:
+ case SFX_ALIGN_LASTRIGHT:
+ {
+ eAlignment = eAlign;
+ }
+ break;
+
+ default:
+ {
+ eAlignment = eAlign;
+ }
+ break;
+ }
+
+ return eAlignment;
+}
+
+
+/*************************************************************************
+|*
+|* Style-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStyle_Impl(const XFormTextStyleItem* pItem)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId = TBI_STYLE_OFF;
+
+ switch ( pItem->GetValue() )
+ {
+ case XFT_ROTATE : nId = TBI_STYLE_ROTATE; break;
+ case XFT_UPRIGHT: nId = TBI_STYLE_UPRIGHT; break;
+ case XFT_SLANTX : nId = TBI_STYLE_SLANTX; break;
+ case XFT_SLANTY : nId = TBI_STYLE_SLANTY; break;
+ default: ;//prevent warning
+ }
+ aTbxStyle.Enable();
+
+ // Make sure that there is allways exactly one checked toolbox item.
+ if ( pItem->GetValue() == XFT_NONE )
+ {
+ aTbxStyle.CheckItem(TBI_STYLE_ROTATE, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_UPRIGHT, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_SLANTX, sal_False);
+ aTbxStyle.CheckItem(TBI_STYLE_SLANTY, sal_False);
+
+ aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_True);
+ }
+ else
+ {
+ aTbxStyle.CheckItem(TBI_STYLE_OFF, sal_False);
+ aTbxStyle.CheckItem(nId);
+ }
+
+ nLastStyleTbxId = nId;
+ }
+ else
+ aTbxStyle.Disable();
+}
+
+/*************************************************************************
+|*
+|* Adjust-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetAdjust_Impl(const XFormTextAdjustItem* pItem)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId;
+
+ aTbxAdjust.Enable();
+ aMtrFldDistance.Enable();
+
+ if ( pItem->GetValue() == XFT_LEFT || pItem->GetValue() == XFT_RIGHT )
+ {
+ if ( pItem->GetValue() == XFT_LEFT ) nId = TBI_ADJUST_LEFT;
+ else nId = TBI_ADJUST_RIGHT;
+ aMtrFldTextStart.Enable();
+ }
+ else
+ {
+ if ( pItem->GetValue() == XFT_CENTER ) nId = TBI_ADJUST_CENTER;
+ else nId = TBI_ADJUST_AUTOSIZE;
+ aMtrFldTextStart.Disable();
+ }
+
+ if ( !aTbxAdjust.IsItemChecked(nId) )
+ {
+ aTbxAdjust.CheckItem(nId);
+ }
+ nLastAdjustTbxId = nId;
+ }
+ else
+ {
+ aTbxAdjust.Disable();
+ aMtrFldTextStart.Disable();
+ aMtrFldDistance.Disable();
+ }
+}
+
+/*************************************************************************
+|*
+|* Abstand-Wert in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetDistance_Impl(const XFormTextDistanceItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldDistance.HasChildPathFocus() )
+ {
+ SetMetricValue( aMtrFldDistance, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+}
+
+/*************************************************************************
+|*
+|* Einzug-Wert in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStart_Impl(const XFormTextStartItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldTextStart.HasChildPathFocus() )
+ {
+ SetMetricValue( aMtrFldTextStart, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+}
+
+/*************************************************************************
+|*
+|* Button fuer Umkehrung der Textrichtung setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem)
+{
+ if ( pItem )
+ aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Standardform im ValueSet anzeigen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetStdForm_Impl(const XFormTextStdFormItem* pItem)
+{
+ if ( pItem )
+ {
+ aFormSet.Enable();
+ aFormSet.SetNoSelection();
+
+ if ( pItem->GetValue() != XFTFORM_NONE )
+ aFormSet.SelectItem(
+ sal::static_int_cast< sal_uInt16 >(pItem->GetValue()));
+ }
+ else
+ aFormSet.Disable();
+}
+
+/*************************************************************************
+|*
+|* Button fuer Konturanzeige setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem)
+{
+ if ( pItem )
+ aTbxShadow.CheckItem(TBI_SHOWFORM, !pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Button fuer Zeichenumrandung setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetOutline_Impl(const XFormTextOutlineItem* pItem)
+{
+ if ( pItem )
+ aTbxShadow.CheckItem(TBI_OUTLINE, pItem->GetValue());
+}
+
+/*************************************************************************
+|*
+|* Shadow-Buttons setzen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadow_Impl(const XFormTextShadowItem* pItem,
+ sal_Bool bRestoreValues)
+{
+ if ( pItem )
+ {
+ sal_uInt16 nId;
+
+ aTbxShadow.Enable();
+
+ if ( pItem->GetValue() == XFTSHADOW_NONE )
+ {
+ nId = TBI_SHADOW_OFF;
+ aFbShadowX.Hide();
+ aFbShadowY.Hide();
+ aMtrFldShadowX.Disable();
+ aMtrFldShadowY.Disable();
+ aShadowColorLB.Disable();
+ }
+ else
+ {
+ aFbShadowX.Show();
+ aFbShadowY.Show();
+ aMtrFldShadowX.Enable();
+ aMtrFldShadowY.Enable();
+ aShadowColorLB.Enable();
+
+ if ( pItem->GetValue() == XFTSHADOW_NORMAL )
+ {
+ nId = TBI_SHADOW_NORMAL;
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+
+// aFbShadowX.SetBitmap( Bitmap( ResId(RID_SVXBMP_SHADOW_XDIST, _pMgr ) ) );
+ //aMtrFldShadowX.SetUnit(FUNIT_MM);
+ aMtrFldShadowX.SetUnit( eDlgUnit );
+ aMtrFldShadowX.SetDecimalDigits(2);
+ aMtrFldShadowX.SetMin(LONG_MIN);
+ aMtrFldShadowX.SetMax(LONG_MAX);
+ if( eDlgUnit == FUNIT_MM )
+ aMtrFldShadowX.SetSpinSize( 50 );
+ else
+ aMtrFldShadowX.SetSpinSize( 10 );
+
+// aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_YDIST, _pMgr ) ) );
+ //aMtrFldShadowY.SetUnit(FUNIT_MM);
+ aMtrFldShadowY.SetUnit( eDlgUnit );
+ aMtrFldShadowY.SetDecimalDigits(2);
+ aMtrFldShadowY.SetMin(LONG_MIN);
+ aMtrFldShadowY.SetMax(LONG_MAX);
+ if( eDlgUnit == FUNIT_MM )
+ aMtrFldShadowY.SetSpinSize( 50 );
+ else
+ aMtrFldShadowY.SetSpinSize( 10 );
+
+ if ( bRestoreValues )
+ {
+ SetMetricValue( aMtrFldShadowX, nSaveShadowX, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aMtrFldShadowY, nSaveShadowY, SFX_MAPUNIT_100TH_MM );
+
+ XFormTextShadowXValItem aXItem( nSaveShadowX );
+ XFormTextShadowYValItem aYItem( nSaveShadowY );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
+ }
+ }
+ else
+ {
+ nId = TBI_SHADOW_SLANT;
+
+// aFbShadowX.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_ANGLE, _pMgr ) ) );
+ aMtrFldShadowX.SetUnit(FUNIT_CUSTOM);
+ aMtrFldShadowX.SetDecimalDigits(1);
+ aMtrFldShadowX.SetMin(-1800);
+ aMtrFldShadowX.SetMax( 1800);
+ aMtrFldShadowX.SetSpinSize(10);
+
+// aFbShadowY.SetBitmap( Bitmap( ResId( RID_SVXBMP_SHADOW_SIZE, _pMgr ) ) );
+ aMtrFldShadowY.SetUnit(FUNIT_CUSTOM);
+ aMtrFldShadowY.SetDecimalDigits(0);
+ aMtrFldShadowY.SetMin(-999);
+ aMtrFldShadowY.SetMax( 999);
+ aMtrFldShadowY.SetSpinSize(10);
+
+ if ( bRestoreValues )
+ {
+ aMtrFldShadowX.SetValue(nSaveShadowAngle);
+ aMtrFldShadowY.SetValue(nSaveShadowSize);
+ XFormTextShadowXValItem aXItem(nSaveShadowAngle);
+ XFormTextShadowYValItem aYItem(nSaveShadowSize);
+ GetBindings().GetDispatcher()->Execute(
+ SID_FORMTEXT_SHDWXVAL, SFX_CALLMODE_RECORD, &aXItem, &aYItem, 0L );
+ }
+ }
+ }
+
+ if ( !aTbxShadow.IsItemChecked(nId) )
+ {
+ aTbxShadow.CheckItem(nId);
+ }
+ nLastShadowTbxId = nId;
+
+ ApplyImageList();
+ }
+ else
+ {
+ aTbxShadow.Disable();
+ aMtrFldShadowX.Disable();
+ aMtrFldShadowY.Disable();
+ aShadowColorLB.Disable();
+ }
+}
+
+/*************************************************************************
+|*
+|* Schattenfarbe in Listbox eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowColor_Impl(const XFormTextShadowColorItem* pItem)
+{
+ if ( pItem )
+ aShadowColorLB.SelectEntry(pItem->GetColorValue());
+}
+
+/*************************************************************************
+|*
+|* X-Wert fuer Schatten in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowXVal_Impl(const XFormTextShadowXValItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldShadowX.HasChildPathFocus() )
+ {
+ // #i19251#
+ // sal_Int32 nValue = pItem->GetValue();
+
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
+ {
+ // #i19251#
+ // There is no value correction necessary at all, i think this
+ // was only tried to be done without understanding that the two
+ // involved fields/items are used double and contain/give different
+ // values regarding to the access method.
+ // nValue = nValue - ( int( float( nValue ) / 360.0 ) * 360 );
+ aMtrFldShadowX.SetValue(pItem->GetValue());
+ }
+ else
+ {
+ SetMetricValue( aMtrFldShadowX, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Y-Wert fuer Schatten in Editfeld eintragen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetShadowYVal_Impl(const XFormTextShadowYValItem* pItem)
+{
+ // #104596# Use HasChildPathFocus() instead of HasFocus() at SpinFields
+ if ( pItem && !aMtrFldShadowY.HasChildPathFocus() )
+ {
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(aTbxShadow.IsItemChecked(TBI_SHADOW_SLANT))
+ {
+ aMtrFldShadowY.SetValue(pItem->GetValue());
+ }
+ else
+ {
+ SetMetricValue( aMtrFldShadowY, pItem->GetValue(), SFX_MAPUNIT_100TH_MM );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectStyleHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxStyle.GetCurItemId();
+
+ // Execute this block when a different toolbox item has been clicked or
+ // when the off item has been clicked. The later is necessary to
+ // override the toolbox behaviour of unchecking the item after second
+ // click on it: One of the items has to be checked at all times (when
+ // enabled that is.)
+ if (nId == TBI_STYLE_OFF || nId != nLastStyleTbxId )
+ {
+ XFormTextStyle eStyle = XFT_NONE;
+
+ switch ( nId )
+ {
+ case TBI_STYLE_ROTATE : eStyle = XFT_ROTATE; break;
+ case TBI_STYLE_UPRIGHT : eStyle = XFT_UPRIGHT; break;
+ case TBI_STYLE_SLANTX : eStyle = XFT_SLANTX; break;
+ case TBI_STYLE_SLANTY : eStyle = XFT_SLANTY; break;
+ }
+ XFormTextStyleItem aItem( eStyle );
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetStyle_Impl( &aItem );
+ nLastStyleTbxId = nId;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectAdjustHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxAdjust.GetCurItemId();
+
+ if ( nId == TBI_ADJUST_MIRROR )
+ {
+ XFormTextMirrorItem aItem(aTbxAdjust.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_MIRROR, SFX_CALLMODE_SLOT, &aItem, 0L );
+ }
+ else if ( nId != nLastAdjustTbxId )
+ {
+ XFormTextAdjust eAdjust = XFT_AUTOSIZE;
+
+ switch ( nId )
+ {
+ case TBI_ADJUST_LEFT : eAdjust = XFT_LEFT; break;
+ case TBI_ADJUST_CENTER : eAdjust = XFT_CENTER; break;
+ case TBI_ADJUST_RIGHT : eAdjust = XFT_RIGHT; break;
+ }
+ XFormTextAdjustItem aItem(eAdjust);
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_ADJUST, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetAdjust_Impl(&aItem);
+ nLastAdjustTbxId = nId;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, SelectShadowHdl_Impl, void *, EMPTYARG )
+{
+ sal_uInt16 nId = aTbxShadow.GetCurItemId();
+
+ if ( nId == TBI_SHOWFORM )
+ {
+ XFormTextHideFormItem aItem(!aTbxShadow.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_HIDEFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ else if ( nId == TBI_OUTLINE )
+ {
+ XFormTextOutlineItem aItem(aTbxShadow.IsItemChecked(nId));
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_OUTLINE, SFX_CALLMODE_RECORD, &aItem, 0L );
+ }
+ else if ( nId != nLastShadowTbxId )
+ {
+ XFormTextShadow eShadow = XFTSHADOW_NONE;
+
+ if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
+ {
+ nSaveShadowX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
+ nSaveShadowY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
+ }
+ else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
+ {
+ nSaveShadowAngle = static_cast<long>(aMtrFldShadowX.GetValue());
+ nSaveShadowSize = static_cast<long>(aMtrFldShadowY.GetValue());
+ }
+ nLastShadowTbxId = nId;
+
+ if ( nId == TBI_SHADOW_NORMAL ) eShadow = XFTSHADOW_NORMAL;
+ else if ( nId == TBI_SHADOW_SLANT ) eShadow = XFTSHADOW_SLANT;
+
+ XFormTextShadowItem aItem(eShadow);
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHADOW, SFX_CALLMODE_RECORD, &aItem, 0L );
+ SetShadow_Impl(&aItem, sal_True);
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
+{
+ aInputTimer.Start();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxFontWorkDialog, ModifyInputHdl_Impl, void *, EMPTYARG )
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, InputTimoutHdl_Impl, void *, EMPTYARG )
+{
+ // System-Metrik evtl. neu setzen
+ // Dieses sollte mal als Listener passieren, ist aber aus
+ // inkompatibilitaetsgruenden z.Z. nicht moeglich
+ const FieldUnit eDlgUnit = rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
+ if( eDlgUnit != aMtrFldDistance.GetUnit() )
+ {
+ SetFieldUnit( aMtrFldDistance, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldTextStart, eDlgUnit, sal_True );
+ aMtrFldDistance.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ aMtrFldTextStart.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ }
+ if( eDlgUnit != aMtrFldShadowX.GetUnit() &&
+ aTbxShadow.IsItemChecked( TBI_SHADOW_NORMAL ) )
+ {
+ SetFieldUnit( aMtrFldShadowX, eDlgUnit, sal_True );
+ SetFieldUnit( aMtrFldShadowY, eDlgUnit, sal_True );
+ aMtrFldShadowX.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ aMtrFldShadowY.SetSpinSize( eDlgUnit == FUNIT_MM ? 50 : 10 );
+ }
+
+ long nValue = GetCoreValue( aMtrFldDistance, SFX_MAPUNIT_100TH_MM );
+ XFormTextDistanceItem aDistItem( nValue );
+ nValue = GetCoreValue( aMtrFldTextStart, SFX_MAPUNIT_100TH_MM );
+ XFormTextStartItem aStartItem( nValue );
+
+ sal_Int32 nValueX(0L);
+ sal_Int32 nValueY(0L);
+
+ // #i19251#
+ // The two involved fields/items are used double and contain/give different
+ // values regarding to the access method. Thus, here we need to separate the access
+ // methos regarding to the kind of value accessed.
+ if(nLastShadowTbxId == TBI_SHADOW_NORMAL)
+ {
+ nValueX = GetCoreValue( aMtrFldShadowX, SFX_MAPUNIT_100TH_MM );
+ nValueY = GetCoreValue( aMtrFldShadowY, SFX_MAPUNIT_100TH_MM );
+ }
+ else if(nLastShadowTbxId == TBI_SHADOW_SLANT)
+ {
+ nValueX = static_cast<long>(aMtrFldShadowX.GetValue());
+ nValueY = static_cast<long>(aMtrFldShadowY.GetValue());
+ }
+
+ XFormTextShadowXValItem aShadowXItem( nValueX );
+ XFormTextShadowYValItem aShadowYItem( nValueY );
+
+ // Slot-ID ist egal, die Exec-Methode wertet das gesamte ItemSet aus
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_DISTANCE, SFX_CALLMODE_RECORD, &aDistItem,
+ &aStartItem, &aShadowXItem, &aShadowYItem, 0L );
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, FormSelectHdl_Impl, void *, EMPTYARG )
+{
+ XFormTextStdFormItem aItem;
+
+ if ( aFormSet.IsNoSelection() )
+ aItem.SetValue(XFTFORM_NONE);
+ else
+ aItem.SetValue(aFormSet.GetSelectItemId());
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STDFORM, SFX_CALLMODE_RECORD, &aItem, 0L );
+ aFormSet.SetNoSelection();
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxFontWorkDialog, ColorSelectHdl_Impl, void *, EMPTYARG )
+{
+// Changed by obo. Linux-Compiler can't parse commented lines
+ XFormTextShadowColorItem aItem( (const String &) String(),
+ (const Color &) aShadowColorLB.GetSelectEntryColor() );
+// XFormTextShadowColorItem aItem( String(),
+// aShadowColorLB.GetSelectEntryColor() );
+ GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_SHDWCOLOR, SFX_CALLMODE_RECORD, &aItem, 0L );
+ return 0;
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetColorTable(const XColorTable* pTable)
+{
+ if ( pTable && pTable != pColorTable )
+ {
+ pColorTable = pTable;
+ aShadowColorLB.Clear();
+ aShadowColorLB.Fill(pColorTable);
+ }
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::SetActive(sal_Bool /*bActivate*/)
+{
+}
+
+/*************************************************************************
+|*
+|* Standard-FontWork-Objekt erzeugen
+|*
+\************************************************************************/
+
+void SvxFontWorkDialog::CreateStdFormObj(SdrView& rView, SdrPageView& rPV,
+ const SfxItemSet& rAttr,
+ SdrObject& rOldObj,
+ XFormTextStdForm eForm)
+{
+ SfxItemSet aAttr(*rAttr.GetPool(), XATTR_FORMTXTSTYLE,
+ XATTR_FORMTXTHIDEFORM);
+ SdrObject* pNewObj = NULL;
+ Rectangle aRect;
+ XFormTextAdjust eAdjust = XFT_AUTOSIZE;
+
+//-/ rOldObj.TakeAttributes(aAttr, sal_True, sal_False);
+ aAttr.Put(rOldObj.GetMergedItemSet());
+
+ const XFormTextStdFormItem& rOldForm = (const XFormTextStdFormItem&)
+ aAttr.Get(XATTR_FORMTXTSTDFORM);
+
+ aRect = rOldObj.GetSnapRect();
+
+ if ( !rOldObj.ISA(SdrPathObj) )
+ {
+ Point aPos = aRect.TopLeft();
+ aRect = rOldObj.GetLogicRect();
+ aRect.SetPos(aPos);
+ }
+
+ aAttr.Put(rAttr);
+
+ if ( rOldForm.GetValue() == XFTFORM_NONE )
+ {
+ long nW = aRect.GetWidth();
+ aRect.SetSize(Size(nW, nW));
+ aAttr.Put(XFormTextStyleItem(XFT_ROTATE));
+ }
+
+ Point aCenter = aRect.Center();
+
+ switch ( eForm )
+ {
+ case XFTFORM_TOPCIRC:
+ case XFTFORM_BOTCIRC:
+ case XFTFORM_LFTCIRC:
+ case XFTFORM_RGTCIRC:
+ case XFTFORM_TOPARC:
+ case XFTFORM_BOTARC:
+ case XFTFORM_LFTARC:
+ case XFTFORM_RGTARC:
+ {
+ long nBeg, nEnd;
+
+ switch ( eForm )
+ {
+ default: ; //prevent warning
+ case XFTFORM_TOPCIRC:
+ nBeg = 0;
+ nEnd = 18000;
+ break;
+ case XFTFORM_BOTCIRC:
+ nBeg = 18000;
+ nEnd = 36000;
+ break;
+ case XFTFORM_LFTCIRC:
+ nBeg = 9000;
+ nEnd = 27000;
+ break;
+ case XFTFORM_RGTCIRC:
+ nBeg = 27000;
+ nEnd = 9000;
+ break;
+ case XFTFORM_TOPARC:
+ nBeg = 4500;
+ nEnd = 13500;
+ break;
+ case XFTFORM_BOTARC:
+ nBeg = 22500;
+ nEnd = 31500;
+ break;
+ case XFTFORM_LFTARC:
+ nBeg = 13500;
+ nEnd = 22500;
+ break;
+ case XFTFORM_RGTARC:
+ nBeg = 31500;
+ nEnd = 4500;
+ break;
+ }
+ pNewObj = new SdrCircObj(OBJ_CARC, aRect, nBeg, nEnd);
+ break;
+ }
+ case XFTFORM_BUTTON1:
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ basegfx::B2DPolygon aLine;
+ long nR = aRect.GetWidth() / 2;
+ basegfx::B2DPolygon aTopArc(XPolygon(aCenter, -nR, nR, 50, 1750, sal_False).getB2DPolygon());
+ basegfx::B2DPolygon aBottomArc(XPolygon(aCenter, -nR, nR, 1850, 3550, sal_False).getB2DPolygon());
+
+ // Polygone schliessen
+ aTopArc.setClosed(true);
+ aBottomArc.setClosed(true);
+ aPolyPolygon.append(aTopArc);
+
+ aLine.append(aBottomArc.getB2DPoint(aBottomArc.count() - 1L));
+ aLine.append(aBottomArc.getB2DPoint(0L));
+ aLine.setClosed(true);
+
+ aPolyPolygon.append(aLine);
+ aPolyPolygon.append(aBottomArc);
+
+ pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
+ eAdjust = XFT_CENTER;
+ break;
+ }
+ case XFTFORM_BUTTON2:
+ case XFTFORM_BUTTON3:
+ case XFTFORM_BUTTON4:
+ {
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ basegfx::B2DPolygon aLine;
+ long nR = aRect.GetWidth() / 2;
+ long nWDiff = nR / 5;
+ long nHDiff;
+
+ if ( eForm == XFTFORM_BUTTON4 )
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 950, 2650, sal_False).getB2DPolygon());
+ aNewArc.setClosed(true);
+ aPolyPolygon.append(aNewArc);
+ eAdjust = XFT_CENTER;
+ }
+ else
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2700, 2700).getB2DPolygon());
+ aPolyPolygon.append(aNewArc);
+ }
+
+ if ( eForm == XFTFORM_BUTTON3 )
+ nHDiff = -aRect.GetHeight() / 10;
+ else
+ nHDiff = aRect.GetHeight() / 20;
+
+ aLine.append(basegfx::B2DPoint(aRect.Left() + nWDiff, aRect.Center().Y() + nHDiff));
+ aLine.append(basegfx::B2DPoint(aRect.Right() - nWDiff, aRect.Center().Y() + nHDiff));
+ aLine.setClosed(true);
+ aPolyPolygon.append(aLine);
+
+ if ( eForm == XFTFORM_BUTTON4 )
+ {
+ basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2750, 850, sal_False).getB2DPolygon());
+ aNewArc.setClosed(true);
+ aPolyPolygon.append(aNewArc);
+ }
+
+ if ( eForm == XFTFORM_BUTTON3 )
+ {
+ nHDiff += nHDiff;
+ aLine.setB2DPoint(0L, basegfx::B2DPoint(aLine.getB2DPoint(0L).getX(), aLine.getB2DPoint(0L).getY() - nHDiff));
+ aLine.setB2DPoint(1L, basegfx::B2DPoint(aLine.getB2DPoint(1L).getX(), aLine.getB2DPoint(1L).getY() - nHDiff));
+ aPolyPolygon.append(aLine);
+ }
+
+ pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon);
+ break;
+ }
+ default: ; //prevent warning
+ }
+ if ( pNewObj )
+ {
+ // #78478# due to DLs changes in Outliner the object needs
+ // a model to get an outliner for later calls to
+ // pNewObj->SetOutlinerParaObject(pPara) (see below).
+ pNewObj->SetModel(rOldObj.GetModel());
+
+ Size aSize;
+ Rectangle aSnap = pNewObj->GetSnapRect();
+
+ aSize.Width() = aRect.Left() - aSnap.Left();
+ aSize.Height() = aRect.Top() - aSnap.Top();
+ pNewObj->NbcMove(aSize);
+
+ rView.BegUndo( SVX_RESSTR( RID_SVXSTR_FONTWORK_UNDOCREATE ) );
+ OutlinerParaObject* pPara = rOldObj.GetOutlinerParaObject();
+ sal_Bool bHide = sal_True;
+
+ if ( pPara != NULL )
+ {
+ pPara = new OutlinerParaObject(*pPara);
+ pNewObj->SetOutlinerParaObject(pPara);
+ }
+ else
+ bHide = sal_False;
+
+ rView.ReplaceObjectAtView(&rOldObj, rPV, pNewObj, sal_True);
+ pNewObj->SetLayer(rOldObj.GetLayer());
+ aAttr.Put(XFormTextHideFormItem(bHide));
+ aAttr.Put(XFormTextAdjustItem(eAdjust));
+
+ XFormTextShadow eShadow = XFTSHADOW_NONE;
+
+ if ( nLastShadowTbxId == TBI_SHADOW_NORMAL )
+ {
+ eShadow = XFTSHADOW_NORMAL;
+ aAttr.Put(XFormTextShadowXValItem(nSaveShadowX));
+ aAttr.Put(XFormTextShadowYValItem(nSaveShadowY));
+ }
+ else if ( nLastShadowTbxId == TBI_SHADOW_SLANT )
+ {
+ eShadow = XFTSHADOW_SLANT;
+ aAttr.Put(XFormTextShadowXValItem(nSaveShadowAngle));
+ aAttr.Put(XFormTextShadowYValItem(nSaveShadowSize));
+ }
+
+ aAttr.Put(XFormTextShadowItem(eShadow));
+
+ rView.SetAttributes(aAttr);
+ rView.EndUndo();
+ }
+}
+
+void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+
+ SfxDockingWindow::DataChanged( rDCEvt );
+}
+/* -----------------------------08.05.2002 14:28------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxFontWorkDialog::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ResMgr* _pMgr = &DIALOG_MGR();
+
+ sal_uInt16 nBitmapResId = bHighContrast ? RID_SVXBMP_FONTWORK_FORM1_H : RID_SVXBMP_FONTWORK_FORM1;
+ sal_uInt16 nTextResId = RID_SVXSTR_FONTWORK_FORM1;
+
+ bool bInit = aFormSet.GetItemCount() == 0;
+
+ if( bInit )
+ {
+/*
+ Size aSize( aTbxStyle.CalcWindowSizePixel() );
+ Bitmap aBmp(ResId(RID_SVXBMP_FONTWORK_FORM1,_pMgr));
+ aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2;
+ aFormSet.SetSizePixel(aSize);
+*/
+ }
+
+ sal_uInt16 i;
+ for( i = 1; i < 13; i++, nTextResId++, nBitmapResId++ )
+ {
+ if( bInit )
+ {
+ aFormSet.InsertItem( i, Bitmap(ResId(nBitmapResId,*_pMgr)),
+ String(ResId(nTextResId,*_pMgr)));
+ }
+ else
+ {
+ aFormSet.SetItemImage( i, Bitmap(ResId(nBitmapResId,*_pMgr)) );
+ }
+ }
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbxStyle.SetImageList( rImgLst );
+ aTbxAdjust.SetImageList( rImgLst );
+ aTbxShadow.SetImageList( rImgLst );
+
+ switch( nLastShadowTbxId )
+ {
+ case TBI_SHADOW_SLANT:
+ aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_ANGLE ) );
+ aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_SIZE ) );
+ break;
+// case TBI_SHADOW_NORMAL:
+ default:
+ aFbShadowX.SetImage( rImgLst.GetImage( TBI_SHADOW_XDIST ) );
+ aFbShadowY.SetImage( rImgLst.GetImage( TBI_SHADOW_YDIST ) );
+ break;
+ }
+
+ aFbDistance.SetImage( rImgLst.GetImage( TBI_DISTANCE ) );
+ aFbTextStart.SetImage( rImgLst.GetImage( TBI_TEXTSTART ) );
+
+}
diff --git a/svx/source/dialog/fontwork.hrc b/svx/source/dialog/fontwork.hrc
new file mode 100644
index 000000000000..cdbc48aa032e
--- /dev/null
+++ b/svx/source/dialog/fontwork.hrc
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define VS_FORMS 1
+#define TBX_STYLE 1
+#define TBX_ADJUST 2
+#define TBX_SHADOW 3
+
+#define FB_DISTANCE 1
+#define FB_TEXTSTART 2
+#define FB_SHADOW_X 3
+#define FB_SHADOW_Y 4
+#define MTR_FLD_DISTANCE 1
+#define MTR_FLD_TEXTSTART 2
+#define MTR_FLD_SHADOW_X 3
+#define MTR_FLD_SHADOW_Y 4
+#define CLB_SHADOW_COLOR 1
+
+#define IL_FONTWORK 1200
+#define ILH_FONTWORK 1201
+
+// the following ids are also used to identify the
+// bitmaps for the image list
+#define TBI_STYLE_OFF 1
+#define TBI_STYLE_ROTATE 2
+#define TBI_STYLE_UPRIGHT 3
+#define TBI_STYLE_SLANTX 4
+#define TBI_STYLE_SLANTY 5
+#define TBI_ADJUST_MIRROR 6
+#define TBI_ADJUST_LEFT 7
+#define TBI_ADJUST_CENTER 8
+#define TBI_ADJUST_RIGHT 9
+#define TBI_ADJUST_AUTOSIZE 10
+#define TBI_SHOWFORM 11
+#define TBI_OUTLINE 12
+#define TBI_SHADOW_OFF 13
+#define TBI_SHADOW_NORMAL 14
+#define TBI_SHADOW_SLANT 15
+#define TBI_SHADOW_XDIST 16
+#define TBI_SHADOW_YDIST 17
+#define TBI_SHADOW_ANGLE 18
+#define TBI_SHADOW_SIZE 19
+#define TBI_DISTANCE 20
+#define TBI_TEXTSTART 21
diff --git a/svx/source/dialog/fontwork.src b/svx/source/dialog/fontwork.src
new file mode 100644
index 000000000000..92d1be8abc97
--- /dev/null
+++ b/svx/source/dialog/fontwork.src
@@ -0,0 +1,560 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "fontwork.hrc"
+#include "helpid.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_FONTWORK ---------------------------------------------------
+DockingWindow RID_SVXDLG_FONTWORK
+{
+ HelpId = CMD_SID_FONTWORK ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 89 , 193 ) ;
+ Text [ en-US ] = "Fontwork" ;
+ Moveable = TRUE ;
+ Zoomable = TRUE ;
+ Closeable = TRUE ;
+ Dockable = TRUE ;
+ EnableResizing = TRUE ;
+ Control VS_FORMS
+ {
+ HelpId = HID_FONTWORK_CTL_FORMS ;
+ Pos = MAP_APPFONT ( 6 , 4 ) ;
+ Size = MAP_APPFONT ( 71 , 30 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ ToolBox TBX_STYLE
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 41 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Identifier = TBI_STYLE_OFF ;
+ HelpId = HID_FONTWORK_TBI_STYLE_OFF ;
+ Text [ en-US ] = "Off" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_ROTATE ;
+ HelpId = HID_FONTWORK_TBI_STYLE_ROTATE ;
+ Text [ en-US ] = "Rotate" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_UPRIGHT ;
+ HelpId = HID_FONTWORK_TBI_STYLE_UPRIGHT ;
+ Text [ en-US ] = "Upright" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_SLANTX ;
+ HelpId = HID_FONTWORK_TBI_STYLE_SLANTX ;
+ Text [ en-US ] = "Slant Horizontal" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_STYLE_SLANTY ;
+ HelpId = HID_FONTWORK_TBI_STYLE_SLANTY ;
+ Text [ en-US ] = "Slant Vertical" ;
+ };
+ };
+ };
+ ToolBox TBX_ADJUST
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 63 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_ADJUST_MIRROR ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_MIRROR ;
+ Text [ en-US ] = "Orientation" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_LEFT ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_LEFT ;
+ Text [ en-US ] = "Align Left" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_CENTER ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_CENTER ;
+ Text [ en-US ] = "Center" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_RIGHT ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_RIGHT ;
+ Text [ en-US ] = "Align Right" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_ADJUST_AUTOSIZE ;
+ HelpId = HID_FONTWORK_TBI_ADJUST_AUTOSIZE ;
+ Text [ en-US ] = "AutoSize Text" ;
+ };
+ };
+ };
+ FixedImage FB_DISTANCE
+ {
+ Pos = MAP_APPFONT ( 10 , 84 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_DISTANCE
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_DISTANCE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 85 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance" ;
+
+ };
+ FixedImage FB_TEXTSTART
+ {
+ Pos = MAP_APPFONT ( 10 , 99 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_TEXTSTART
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_TEXTSTART";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 100 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Indent" ;
+ };
+ ToolBox TBX_SHADOW
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 122 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_SHOWFORM ;
+ HelpId = HID_FONTWORK_TBI_SHOWFORM ;
+ Text [ en-US ] = "Contour" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ Checkable = TRUE ;
+ Identifier = TBI_OUTLINE ;
+ HelpId = HID_FONTWORK_TBI_OUTLINE ;
+ Text [ en-US ] = "Text Contour" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_OFF ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_OFF ;
+ Text [ en-US ] = "No Shadow" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_NORMAL ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_NORMAL ;
+ Text [ en-US ] = "Vertical" ;
+ };
+ ToolBoxItem
+ {
+ AutoCheck = TRUE ;
+ RadioCheck = TRUE ;
+ Identifier = TBI_SHADOW_SLANT ;
+ HelpId = HID_FONTWORK_TBI_SHADOW_SLANT ;
+ Text [ en-US ] = "Slant" ;
+ };
+ };
+ };
+ FixedImage FB_SHADOW_X
+ {
+ Pos = MAP_APPFONT ( 10 , 143 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_SHADOW_X
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_SHADOW_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 144 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -5000000 ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ First = -5000000 ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance X" ;
+ };
+ FixedImage FB_SHADOW_Y
+ {
+ Pos = MAP_APPFONT ( 10 , 158 ) ;
+ Size = MAP_APPFONT ( 14 , 15 ) ;
+ };
+ MetricField MTR_FLD_SHADOW_Y
+ {
+ HelpID = "svx:MetricField:RID_SVXDLG_FONTWORK:MTR_FLD_SHADOW_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 29 , 159 ) ;
+ Size = MAP_APPFONT ( 48 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 5000000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ Last = 5000000 ;
+ SpinSize = 50 ;
+ QuickHelpText [ en-US ] = "Distance Y" ;
+ CustomUnitText [ en-US ] = "%" ;
+ };
+ ListBox CLB_SHADOW_COLOR
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_FONTWORK:CLB_SHADOW_COLOR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 174 ) ;
+ Size = MAP_APPFONT ( 71 , 60 ) ;
+ DropDown = TRUE ;
+ QuickHelpText [ en-US ] = "Shadow Color" ;
+ Text = "-";
+ };
+
+#define FONTWORK_IDLIST \
+ IdList = \
+ { \
+ TBI_STYLE_OFF ; \
+ TBI_STYLE_ROTATE ; \
+ TBI_STYLE_UPRIGHT ; \
+ TBI_STYLE_SLANTX ; \
+ TBI_STYLE_SLANTY ; \
+ TBI_ADJUST_MIRROR ; \
+ TBI_ADJUST_LEFT ; \
+ TBI_ADJUST_CENTER ; \
+ TBI_ADJUST_RIGHT ; \
+ TBI_ADJUST_AUTOSIZE ; \
+ TBI_SHOWFORM ; \
+ TBI_OUTLINE ; \
+ TBI_SHADOW_OFF ; \
+ TBI_SHADOW_NORMAL ; \
+ TBI_SHADOW_SLANT ; \
+ TBI_SHADOW_XDIST ; \
+ TBI_SHADOW_YDIST ; \
+ TBI_SHADOW_ANGLE ; \
+ TBI_SHADOW_SIZE ; \
+ TBI_DISTANCE ; \
+ TBI_TEXTSTART ; \
+ }; \
+ IdCount = { 21 ; };
+
+ #define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; }
+
+ ImageList IL_FONTWORK
+ {
+ Prefix = "fw";
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ FONTWORK_IDLIST
+ };
+ ImageList ILH_FONTWORK
+ {
+ Prefix = "fwh";
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ FONTWORK_IDLIST
+ };
+};
+ // Bitmaps ---------------------------------------------------------------
+Bitmap RID_SVXBMP_FONTWORK_FORM1
+{
+ File = "fwthcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM2
+{
+ File = "fwbhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM3
+{
+ File = "fwlhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM4
+{
+ File = "fwrhcirc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM5
+{
+ File = "fwtoparc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM6
+{
+ File = "fwbotarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM7
+{
+ File = "fwlftarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM8
+{
+ File = "fwrgtarc.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM9
+{
+ File = "fwbuttn1.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM10
+{
+ File = "fwbuttn2.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM11
+{
+ File = "fwbuttn3.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM12
+{
+ File = "fwbuttn4.bmp" ;
+};
+
+Bitmap RID_SVXBMP_FONTWORK_FORM1_H
+{
+ File = "fwthcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM2_H
+{
+ File = "fwbhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM3_H
+{
+ File = "fwlhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM4_H
+{
+ File = "fwrhcirc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM5_H
+{
+ File = "fwtoparc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM6_H
+{
+ File = "fwbotarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM7_H
+{
+ File = "fwlftarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM8_H
+{
+ File = "fwrgtarc_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM9_H
+{
+ File = "fwbuttn1_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM10_H
+{
+ File = "fwbuttn2_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM11_H
+{
+ File = "fwbuttn3_h.bmp" ;
+};
+Bitmap RID_SVXBMP_FONTWORK_FORM12_H
+{
+ File = "fwbuttn4_h.bmp" ;
+};
+
+ // Strings ---------------------------------------------------------------
+String RID_SVXSTR_FONTWORK_FORM1
+{
+ Text [ en-US ] = "Upper Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM2
+{
+ Text [ en-US ] = "Lower Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM3
+{
+ Text [ en-US ] = "Left Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM4
+{
+ Text [ en-US ] = "Right Semicircle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM5
+{
+ Text [ en-US ] = "Upper Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM6
+{
+ Text [ en-US ] = "Lower Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM7
+{
+ Text [ en-US ] = "Left Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM8
+{
+ Text [ en-US ] = "Right Arc" ;
+};
+String RID_SVXSTR_FONTWORK_FORM9
+{
+ Text [ en-US ] = "Open Circle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM10
+{
+ Text [ en-US ] = "Closed Circle" ;
+};
+String RID_SVXSTR_FONTWORK_FORM11
+{
+ Text [ en-US ] = "Closed Circle II" ;
+};
+String RID_SVXSTR_FONTWORK_FORM12
+{
+ Text [ en-US ] = "Open Circle Vertical" ;
+};
+String RID_SVXSTR_FONTWORK_UNDOCREATE
+{
+ Text [ en-US ] = "Create Fontwork object" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
new file mode 100644
index 000000000000..45ceac57c564
--- /dev/null
+++ b/svx/source/dialog/framelink.cxx
@@ -0,0 +1,1531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/framelink.hxx>
+
+#include <math.h>
+#include <vcl/outdev.hxx>
+#include <editeng/borderline.hxx>
+
+// ----------------------------------------------------------------------------
+
+/** Define to select the drawing mode of thin dotted lines.
+
+ 0 = Draw lines using an own implementation (recommended). Draws always
+ little dots in an appropriate distance.
+ 1 = Draw dotted lines using vcl/LineInfo. Results in dashed lines instead
+ of dotted lines, which may look ugly for diagonal lines.
+ */
+#define SVX_FRAME_USE_LINEINFO 0
+
+// ----------------------------------------------------------------------------
+
+#if SVX_FRAME_USE_LINEINFO
+#include <vcl/lineinfo.hxx>
+#endif
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+typedef std::vector< Point > PointVec;
+
+// ----------------------------------------------------------------------------
+// Link result structs for horizontal and vertical lines and borders.
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct is used to return coordinate offsets for one end of a single
+ line in a frame border, i.e. the left end of the primary line of a
+ horizontal frame border.
+
+ 1) Usage for horizontal lines
+
+ If this struct is returned by the lclLinkHorFrameBorder() function, each
+ member refers to the X coordinate of one edge of a single line end in a
+ horizontal frame border. They specify an offset to modify this coordinate
+ when the line is painted. The values in this struct may change a
+ rectangular line shape into a line with slanted left or right border, which
+ is used to connect the line with diagonal lines.
+
+ Usage for a left line end: Usage for a right line end:
+ mnOffs1 mnOffs1
+ <-------> <------->
+ +-------------------------------+
+ | the original horizontal line |
+ +-------------------------------+
+ <-------> <------->
+ mnOffs2 mnOffs2
+
+ 2) Usage for vertical lines
+
+ If this struct is returned by the lclLinkVerFrameBorder() function, each
+ member refers to the Y coordinate of one edge of a single line end in a
+ vertical frame border. They specify an offset to modify this coordinate
+ when the line is painted. The values in this struct may change a
+ rectangular line shape into a line with slanted top or bottom border, which
+ is used to connect the line with diagonal lines.
+
+ Usage for a top line end: mnOffs1 ^ ^ mnOffs2
+ | +-------+ |
+ v | | v
+ | |
+ | |
+ the original vertical line ---> | |
+ | |
+ | |
+ ^ | | ^
+ | +-------+ |
+ Usage for a bottom line end: mnOffs1 v v mnOffs2
+ */
+struct LineEndResult
+{
+ long mnOffs1; /// Offset for top or left edge, dependent of context.
+ long mnOffs2; /// Offset for bottom or right edge, dependent of context
+
+ inline explicit LineEndResult() : mnOffs1( 0 ), mnOffs2( 0 ) {}
+
+ inline void Swap() { std::swap( mnOffs1, mnOffs2 ); }
+ inline void Negate() { mnOffs1 = -mnOffs1; mnOffs2 = -mnOffs2; }
+};
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct contains the linking results for one end of a frame border,
+ including both the primary and secondary line ends.
+ */
+struct BorderEndResult
+{
+ LineEndResult maPrim; /// Result for primary line.
+ LineEndResult maSecn; /// Result for secondary line.
+
+ inline void Negate() { maPrim.Negate(); maSecn.Negate(); }
+};
+
+/** Result struct used by the horizontal/vertical frame link functions.
+
+ This struct contains the linking results for both frame border ends, and
+ therefore for the complete frame border.
+ */
+struct BorderResult
+{
+ BorderEndResult maBeg; /// Result for begin of border line (left or top end).
+ BorderEndResult maEnd; /// Result for end of border line (right or bottom end).
+};
+
+// ----------------------------------------------------------------------------
+// Link result structs for diagonal lines and borders.
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for one line of a diagonal frame
+ border.
+ */
+struct DiagLineResult
+{
+ long mnLClip; /// Offset for left border of clipping rectangle.
+ long mnRClip; /// Offset for right border of clipping rectangle.
+ long mnTClip; /// Offset for top border of clipping rectangle.
+ long mnBClip; /// Offset for bottom border of clipping rectangle.
+
+ inline explicit DiagLineResult() : mnLClip( 0 ), mnRClip( 0 ), mnTClip( 0 ), mnBClip( 0 ) {}
+};
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for one diagonal frame border.
+ */
+struct DiagBorderResult
+{
+ DiagLineResult maPrim; /// Result for primary line.
+ DiagLineResult maSecn; /// Result for secondary line.
+};
+
+/** Result struct used by the diagonal frame link functions.
+
+ This struct contains the linking results for both diagonal frame borders.
+ */
+struct DiagBordersResult
+{
+ DiagBorderResult maTLBR; /// Result for top-left to bottom-right frame border.
+ DiagBorderResult maBLTR; /// Result for bottom-left to top-right frame border.
+};
+
+// ----------------------------------------------------------------------------
+
+/** A helper struct containing two points of a line.
+ */
+struct LinePoints
+{
+ Point maBeg; /// Start position of the line.
+ Point maEnd; /// End position of the line.
+
+ explicit LinePoints( const Point& rBeg, const Point& rEnd ) :
+ maBeg( rBeg ), maEnd( rEnd ) {}
+ explicit LinePoints( const Rectangle& rRect, bool bTLBR ) :
+ maBeg( bTLBR ? rRect.TopLeft() : rRect.TopRight() ),
+ maEnd( bTLBR ? rRect.BottomRight() : rRect.BottomLeft() ) {}
+};
+
+// ============================================================================
+
+/** Rounds and casts a double value to a long value. */
+inline long lclD2L( double fValue )
+{
+ return static_cast< long >( (fValue < 0.0) ? (fValue - 0.5) : (fValue + 0.5) );
+}
+
+/** Converts a width in twips to a width in another map unit (specified by fScale). */
+sal_uInt16 lclScaleValue( long nValue, double fScale, sal_uInt16 nMaxWidth )
+{
+ // convert any width except 0 to at least 1 unit
+ // #i61324# 1 twip must scale to 1/100mm
+ return nValue ? static_cast< sal_uInt16 >( std::min< long >( std::max(
+ static_cast< long >( nValue * fScale ), 1L ), nMaxWidth ) ) : 0;
+}
+
+// ----------------------------------------------------------------------------
+// Line width offset calculation.
+
+/** Returns the start offset of the single/primary line across the frame border.
+
+ All following lclGet*Beg() and lclGet*End() functions return sub units to
+ increase the computational accuracy, where 256 sub units are equal to
+ 1 map unit of the used OutputDevice.
+
+ The following pictures show the upper end of a vertical frame border and
+ illustrates the return values of all following lclGet*Beg() and lclGet*End()
+ functions. The first picture shows a single frame border, the second picture
+ shows a double frame border.
+
+ The functions regard the reference point handling mode of the passed border
+ style.
+ REFMODE_CENTERED:
+ All returned offsets are relative to the middle position of the frame
+ border (offsets left of the middle are returned negative, offsets right
+ of the middle are returned positive).
+ REFMODE_BEGIN:
+ All returned offsets are relative to the begin of the frame border
+ (lclGetBeg() always returns 0).
+ REFMODE_END:
+ All returned offsets are relative to the end of the frame border
+ (lclGetEnd() always returns 0).
+
+ |<- lclGetEnd()
+ |<- lclGetBeforeBeg() |<- lclGetPrimEnd()
+ | |
+ ||<- lclGetBeg() ||<- lclGetBehindEnd()
+ || ||
+ |#################################|
+ direction of | #################################
+ the frame | #################################
+ border is | #################################
+ vertical | #################################
+ v #################################
+ |
+ |<- middle of the frame border
+
+
+ lclGetDistEnd() ->||<- lclGetSecnBeg()
+ ||
+ lclGetBeg() ->| lclGetDistBeg() ->| || |<- lclGetEnd()
+ | | || |
+ lclGetBeforeBeg()->|| lclGetPrimEnd() ->|| || ||<- lclGetBehindEnd()
+ || || || ||
+ |######################| |#############|
+ direction of | ###################### #############
+ the frame | ###################### #############
+ border is | ###################### #############
+ vertical | ###################### | #############
+ v ###################### | #############
+ primary line | secondary line
+ |
+ |<- middle of the frame border
+
+ @return
+ The start offset of the single/primary line relative to the reference
+ position of the frame border (sub units; 0 for invisible or one pixel
+ wide single frame styles).
+ */
+long lclGetBeg( const Style& rBorder )
+{
+ long nPos = 0;
+ switch( rBorder.GetRefMode() )
+ {
+ case REFMODE_CENTERED: if( rBorder.Prim() ) nPos = -128 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_END: if( rBorder.Prim() ) nPos = -256 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_BEGIN: break;
+ }
+ return nPos;
+}
+
+/** Returns the end offset of the single/secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the single/secondary line relative to the
+ reference position of the frame border (sub units; 0 for invisible or one
+ pixel wide single frame styles). */
+long lclGetEnd( const Style& rBorder )
+{
+ long nPos = 0;
+ switch( rBorder.GetRefMode() )
+ {
+ case REFMODE_CENTERED: if( rBorder.Prim() ) nPos = 128 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_BEGIN: if( rBorder.Prim() ) nPos = 256 * (rBorder.GetWidth() - 1); break;
+ case REFMODE_END: break;
+ }
+ return nPos;
+}
+
+/** Returns the end offset of the primary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the primary line relative to the reference
+ position of the frame border (sub units; the end of the primary line in a
+ double frame style, otherwise the same as lclGetEnd()). */
+inline long lclGetPrimEnd( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetBeg( rBorder ) + 256 * (rBorder.Prim() - 1)) : 0; }
+
+/** Returns the start offset of the secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The start offset of the secondary line relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetSecnBeg( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetEnd( rBorder ) - 256 * (rBorder.Secn() - 1)) : 0; }
+
+/** Returns the start offset of the distance space across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The start offset of the distance space relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetDistBeg( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetBeg( rBorder ) + 256 * rBorder.Prim()) : 0; }
+
+/** Returns the end offset of the distance space across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The end offset of the distance space relative to the reference
+ position of the frame border (sub units; 0 for single/invisible border
+ styles). */
+inline long lclGetDistEnd( const Style& rBorder )
+{ return rBorder.Secn() ? (lclGetEnd( rBorder ) - 256 * rBorder.Secn()) : 0; }
+
+/** Returns the offset before start of single/primary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The offset directly before start of single/primary line relative
+ to the reference position of the frame border (sub units; a value one less
+ than lclGetBeg() for visible frame styles, or 0 for invisible frame style). */
+inline long lclGetBeforeBeg( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetBeg( rBorder ) - 256) : 0; }
+
+/** Returns the offset behind end of single/secondary line across the frame border.
+ @descr See description of lclGetBeg() for an illustration.
+ @return The offset directly behind end of single/secondary line relative
+ to the reference position of the frame border (sub units; a value one
+ greater than lclGetEnd() for visible frame styles, or 0 for invisible frame
+ style). */
+inline long lclGetBehindEnd( const Style& rBorder )
+{ return rBorder.Prim() ? (lclGetEnd( rBorder ) + 256) : 0; }
+
+// ============================================================================
+// Linking functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Linking of single horizontal line ends.
+
+/** Calculates X offsets for the left end of a single horizontal frame border.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left line end.
+ */
+void lclLinkLeftEnd_Single(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ // both vertical and diagonal frame borders are double
+ if( rLFromT.Secn() && rLFromB.Secn() && rLFromTR.Secn() && rLFromBR.Secn() )
+ {
+ // take left position of upper and lower secondary start
+ rResult.mnOffs1 = GetBLDiagOffset( lclGetBeg( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ rResult.mnOffs2 = GetTLDiagOffset( lclGetEnd( rBorder ), lclGetSecnBeg( rLFromBR ), rLFromBR.GetAngle() );
+ }
+ else
+ {
+ // both vertical frame borders are double
+ if( rLFromT.Secn() && rLFromB.Secn() )
+ rResult.mnOffs1 = (!rLFromTR.Secn() && !rLFromBR.Secn() && (rLFromT.GetWidth() == rLFromB.GetWidth())) ?
+ // don't overdraw vertical borders with equal width
+ lclGetBehindEnd( rLFromT ) :
+ // take leftmost start of both secondary lines (#46488#)
+ rResult.mnOffs1 = std::min( lclGetSecnBeg( rLFromT ), lclGetSecnBeg( rLFromB ) );
+
+ // single border with equal width coming from left
+ else if( !rLFromL.Secn() && (rLFromL.Prim() == rBorder.Prim()) )
+ // draw to connection point
+ rResult.mnOffs1 = 0;
+
+ // single border coming from left
+ else if( !rLFromL.Secn() && rLFromL.Prim() )
+ {
+ if( rLFromL.Prim() == rBorder.Prim() )
+ // draw to reference position, if from left has equal width
+ rResult.mnOffs1 = 0;
+ else
+ rResult.mnOffs1 = (rLFromL < rBorder) ?
+ // take leftmost start of both frame borders, if from left is thinner
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) ) :
+ // do not overdraw vertical, if from left is thicker
+ std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+ }
+
+ // no border coming from left
+ else if( !rLFromL.Prim() )
+ // don't overdraw vertical borders with equal width
+ rResult.mnOffs1 = (rLFromT.GetWidth() == rLFromB.GetWidth()) ?
+ lclGetBehindEnd( rLFromT ) :
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) );
+
+ // double frame border coming from left and from top
+ else if( rLFromT.Secn() )
+ // do not overdraw the vertical double frame border
+ rResult.mnOffs1 = lclGetBehindEnd( rLFromT );
+
+ // double frame border coming from left and from bottom
+ else if( rLFromB.Secn() )
+ // do not overdraw the vertical double frame border
+ rResult.mnOffs1 = lclGetBehindEnd( rLFromB );
+
+ // double frame border coming from left, both vertical frame borders are single or off
+ else
+ // draw from leftmost start of both frame borders, if from left is not thicker
+ rResult.mnOffs1 = (rLFromL <= rBorder) ?
+ std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) ) :
+ std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+
+ // bottom-left point is equal to top-left point (results in rectangle)
+ rResult.mnOffs2 = rResult.mnOffs1;
+ }
+}
+
+/** Calculates X offsets for the left end of a primary horizontal line.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the primary line.
+ */
+void lclLinkLeftEnd_Prim(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& /*rLFromBR*/ )
+{
+ // double diagonal frame border coming from top right
+ if( rLFromTR.Secn() )
+ {
+ // draw from where secondary diagonal line meets the own primary
+ rResult.mnOffs1 = GetBLDiagOffset( lclGetBeg( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ rResult.mnOffs2 = GetBLDiagOffset( lclGetPrimEnd( rBorder ), lclGetSecnBeg( rLFromTR ), rLFromTR.GetAngle() );
+ }
+
+ // no or single diagonal frame border - ignore it
+ else
+ {
+ // double frame border coming from top
+ if( rLFromT.Secn() )
+ // draw from left edge of secondary vertical
+ rResult.mnOffs1 = lclGetSecnBeg( rLFromT );
+
+ // double frame border coming from left (from top is not double)
+ else if( rLFromL.Secn() )
+ // do not overdraw single frame border coming from top
+ rResult.mnOffs1 = (rLFromL.GetWidth() == rBorder.GetWidth()) ?
+ 0 : lclGetBehindEnd( rLFromT );
+
+ // double frame border coming from bottom (from top and from left are not double)
+ else if( rLFromB.Secn() )
+ // draw from left edge of primary vertical from bottom
+ rResult.mnOffs1 = lclGetBeg( rLFromB );
+
+ // no other frame border is double
+ else
+ // do not overdraw vertical frame borders
+ rResult.mnOffs1 = std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+
+ // bottom-left point is equal to top-left point (results in rectangle)
+ rResult.mnOffs2 = rResult.mnOffs1;
+ }
+}
+
+/** Calculates X offsets for the left end of a secondary horizontal line.
+
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the secondary line.
+ */
+void lclLinkLeftEnd_Secn(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ /* Recycle lclLinkLeftEnd_Prim() function with mirrored horizontal borders. */
+ lclLinkLeftEnd_Prim( rResult, rBorder.Mirror(), rLFromBR, rLFromB, rLFromL.Mirror(), rLFromT, rLFromTR );
+ rResult.Swap();
+}
+
+// ----------------------------------------------------------------------------
+// Linking of horizontal frame border ends.
+
+/** Calculates X offsets for the left end of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the left end of the line(s) in the frame border.
+ */
+void lclLinkLeftEnd(
+ BorderEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR )
+{
+ if( rBorder.Secn() )
+ {
+ // current frame border is double
+ lclLinkLeftEnd_Prim( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ lclLinkLeftEnd_Secn( rResult.maSecn, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ }
+ else if( rBorder.Prim() )
+ {
+ // current frame border is single
+ lclLinkLeftEnd_Single( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ }
+ else
+ {
+ DBG_ERRORFILE( "lclLinkLeftEnd - called for invisible frame style" );
+ }
+}
+
+/** Calculates X offsets for the right end of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of the right end of the line(s) in the frame border.
+ */
+void lclLinkRightEnd(
+ BorderEndResult& rResult, const Style& rBorder,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL )
+{
+ /* Recycle lclLinkLeftEnd() function with mirrored vertical borders. */
+ lclLinkLeftEnd( rResult, rBorder, rRFromTL.Mirror(), rRFromT.Mirror(), rRFromR, rRFromB.Mirror(), rRFromBL.Mirror() );
+ rResult.Negate();
+}
+
+// ----------------------------------------------------------------------------
+// Linking of horizontal and vertical frame borders.
+
+/** Calculates X offsets for all line ends of a horizontal frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawHorFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ X coordinates of both ends of the line(s) in the frame border. To get
+ the actual X coordinates to draw the lines, these offsets have to be
+ added to the X coordinates of the reference points of the frame border
+ (the offsets may be negative).
+ */
+void lclLinkHorFrameBorder(
+ BorderResult& rResult, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL )
+{
+ lclLinkLeftEnd( rResult.maBeg, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ lclLinkRightEnd( rResult.maEnd, rBorder, rRFromTL, rRFromT, rRFromR, rRFromB, rRFromBL );
+}
+
+/** Calculates Y offsets for all line ends of a vertical frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawVerFrameBorder() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for the
+ Y coordinates of both ends of the line(s) in the frame border. To get
+ the actual Y coordinates to draw the lines, these offsets have to be
+ added to the Y coordinates of the reference points of the frame border
+ (the offsets may be negative).
+ */
+void lclLinkVerFrameBorder(
+ BorderResult& rResult, const Style& rBorder,
+ const DiagStyle& rTFromBL, const Style& rTFromL, const Style& rTFromT, const Style& rTFromR, const DiagStyle& rTFromBR,
+ const DiagStyle& rBFromTL, const Style& rBFromL, const Style& rBFromB, const Style& rBFromR, const DiagStyle& rBFromTR )
+{
+ /* Recycle lclLinkHorFrameBorder() function with correct parameters. The
+ frame border is virtually mirrored at the top-left to bottom-right
+ diagonal. rTFromBR and rBFromTL are mirrored to process their primary
+ and secondary lines correctly. */
+ lclLinkHorFrameBorder( rResult, rBorder,
+ rTFromBL, rTFromL, rTFromT, rTFromR, rTFromBR.Mirror(),
+ rBFromTL.Mirror(), rBFromL, rBFromB, rBFromR, rBFromTR );
+}
+
+// ============================================================================
+
+#if 0
+// Not used anymore, but not deleted for possible future usage.
+
+/** Returns the relative Y offset of the intercept point of 2 diagonal borders.
+
+ @param nTLBROffs
+ Width offset (sub units) across the top-left to bottom-right frame border.
+ @param fTLBRAngle
+ Inner angle between horizontal and top-left to bottom-right frame border.
+ @param nBLTROffs
+ Width offset (sub units) across the bottom-left to top-right frame border.
+ @param fBLTRAngle
+ Inner angle between horizontal and bottom-left to top-right frame border.
+ @return
+ Offset (sub units) relative to the Y position of the centered intercept
+ point of both diagonal frame borders.
+ */
+long lclGetDiagDiagOffset( long nTLBROffs, double fTLBRAngle, long nBLTROffs, double fBLTRAngle )
+{
+ double fASin = sin( fTLBRAngle );
+ double fACos = cos( fTLBRAngle );
+ double fAX = -nTLBROffs * fASin;
+ double fAY = nTLBROffs * fACos;
+ double fRAX = fACos;
+ double fRAY = fASin;
+
+ double fBSin = sin( fBLTRAngle );
+ double fBCos = cos( fBLTRAngle );
+ double fBX = nBLTROffs * fBSin;
+ double fBY = nBLTROffs * fBCos;
+ double fRBX = fBCos;
+ double fRBY = -fBSin;
+
+ double fKA = (fRBX * (fBY - fAY) - fRBY * (fBX - fAX)) / (fRBX * fRAY - fRAX * fRBY);
+ return lclD2L( fAY + fKA * fRAY );
+}
+#endif
+
+// ----------------------------------------------------------------------------
+// Linking of diagonal frame borders.
+
+/** Calculates clipping offsets for a top-left to bottom-right frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame border.
+ */
+void lclLinkTLBRFrameBorder(
+ DiagBorderResult& rResult, const Style& rBorder,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL )
+{
+ bool bIsDbl = rBorder.Secn() != 0;
+
+ rResult.maPrim.mnLClip = lclGetBehindEnd( rTLFromB );
+ rResult.maPrim.mnRClip = (bIsDbl && rBRFromT.Secn()) ? lclGetEnd( rBRFromT ) : lclGetBeforeBeg( rBRFromT );
+ rResult.maPrim.mnTClip = (bIsDbl && rTLFromR.Secn()) ? lclGetBeg( rTLFromR ) : lclGetBehindEnd( rTLFromR );
+ rResult.maPrim.mnBClip = lclGetBeforeBeg( rBRFromL );
+
+ if( bIsDbl )
+ {
+ rResult.maSecn.mnLClip = rTLFromB.Secn() ? lclGetBeg( rTLFromB ) : lclGetBehindEnd( rTLFromB );
+ rResult.maSecn.mnRClip = lclGetBeforeBeg( rBRFromT );
+ rResult.maSecn.mnTClip = lclGetBehindEnd( rTLFromR );
+ rResult.maSecn.mnBClip = rBRFromL.Secn() ? lclGetEnd( rBRFromL ) : lclGetBeforeBeg( rBRFromL );
+ }
+}
+
+/** Calculates clipping offsets for a bottom-left to top-right frame border.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame border.
+ */
+void lclLinkBLTRFrameBorder(
+ DiagBorderResult& rResult, const Style& rBorder,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL )
+{
+ bool bIsDbl = rBorder.Secn() != 0;
+
+ rResult.maPrim.mnLClip = lclGetBehindEnd( rBLFromT );
+ rResult.maPrim.mnRClip = (bIsDbl && rTRFromB.Secn()) ? lclGetEnd( rTRFromB ) : lclGetBeforeBeg( rTRFromB );
+ rResult.maPrim.mnTClip = lclGetBehindEnd( rTRFromL );
+ rResult.maPrim.mnBClip = (bIsDbl && rBLFromR.Secn()) ? lclGetEnd( rBLFromR ) : lclGetBeforeBeg( rBLFromR );
+
+ if( bIsDbl )
+ {
+ rResult.maSecn.mnLClip = rBLFromT.Secn() ? lclGetBeg( rBLFromT ) : lclGetBehindEnd( rBLFromT );
+ rResult.maSecn.mnRClip = lclGetBeforeBeg( rTRFromB );
+ rResult.maSecn.mnTClip = rTRFromL.Secn() ? lclGetBeg( rTRFromL ) : lclGetBehindEnd( rTRFromL );
+ rResult.maSecn.mnBClip = lclGetBeforeBeg( rBLFromR );
+ }
+}
+
+/** Calculates clipping offsets for both diagonal frame borders.
+
+ This function can be used for single and double frame borders.
+ See DrawDiagFrameBorders() function for a description of all parameters.
+
+ @param rResult
+ (out-param) The contained values (sub units) specify offsets for all
+ borders of the reference rectangle containing the diagonal frame
+ borders.
+ */
+void lclLinkDiagFrameBorders(
+ DiagBordersResult& rResult, const Style& rTLBR, const Style& rBLTR,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL )
+{
+ lclLinkTLBRFrameBorder( rResult.maTLBR, rTLBR, rTLFromB, rTLFromR, rBRFromT, rBRFromL );
+ lclLinkBLTRFrameBorder( rResult.maBLTR, rBLTR, rBLFromT, rBLFromR, rTRFromB, rTRFromL );
+}
+
+// ============================================================================
+// Drawing functions
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// Simple helper functions
+
+/** Converts sub units to OutputDevice map units. */
+inline long lclToMapUnit( long nSubUnits )
+{
+ return ((nSubUnits < 0) ? (nSubUnits - 127) : (nSubUnits + 128)) / 256;
+}
+
+/** Converts a point in sub units to an OutputDevice point. */
+inline Point lclToMapUnit( long nSubXPos, long nSubYPos )
+{
+ return Point( lclToMapUnit( nSubXPos ), lclToMapUnit( nSubYPos ) );
+}
+
+/** Returns a polygon constructed from a vector of points. */
+inline Polygon lclCreatePolygon( const PointVec& rPoints )
+{
+ return Polygon( static_cast< sal_uInt16 >( rPoints.size() ), &rPoints[ 0 ] );
+}
+
+/** Returns a polygon constructed from the four passed points. */
+Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
+{
+ PointVec aPoints;
+ aPoints.reserve( 4 );
+ aPoints.push_back( rP1 );
+ aPoints.push_back( rP2 );
+ aPoints.push_back( rP3 );
+ aPoints.push_back( rP4 );
+ return lclCreatePolygon( aPoints );
+}
+
+/** Returns a polygon constructed from the five passed points. */
+Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4, const Point& rP5 )
+{
+ PointVec aPoints;
+ aPoints.reserve( 5 );
+ aPoints.push_back( rP1 );
+ aPoints.push_back( rP2 );
+ aPoints.push_back( rP3 );
+ aPoints.push_back( rP4 );
+ aPoints.push_back( rP5 );
+ return lclCreatePolygon( aPoints );
+}
+
+/** Returns a polygon constructed from the two passed line positions. */
+inline Polygon lclCreatePolygon( const LinePoints& rPoints1, const LinePoints& rPoints2 )
+{
+ return lclCreatePolygon( rPoints1.maBeg, rPoints1.maEnd, rPoints2.maEnd, rPoints2.maBeg );
+}
+
+/** Sets the color of the passed frame style to the output device.
+
+ Sets the line color and fill color in the output device.
+
+ @param rDev
+ The output device the color has to be set to. The old colors are pushed
+ onto the device's stack and can be restored with a call to
+ OutputDevice::Pop(). Please take care about the correct calling order
+ of Pop() if this function is used with other functions pushing
+ something onto the stack.
+ @param rStyle
+ The border style that contains the line color to be set to the device.
+ */
+void lclSetColorToOutDev( OutputDevice& rDev, const Style& rStyle, const Color* pForceColor )
+{
+ rDev.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ rDev.SetLineColor( pForceColor ? *pForceColor : rStyle.GetColor() );
+ rDev.SetFillColor( pForceColor ? *pForceColor : rStyle.GetColor() );
+}
+
+// ----------------------------------------------------------------------------
+// Generic drawing functions.
+
+/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
+void lclDrawThinLine( OutputDevice& rDev, const Point& rBeg, const Point& rEnd, bool bDotted )
+{
+#if SVX_FRAME_USE_LINEINFO
+ if( bDotted && (rBeg != rEnd) )
+ {
+// using LineInfo for dotted lines looks ugly and does not work well for diagonal lines
+ LineInfo aLineInfo( LINE_DASH, 1 );
+ aLineInfo.SetDotCount( 1 );
+ aLineInfo.SetDotLen( 1 );
+ aLineInfo.SetDistance( 3 );
+ rDev.DrawLine( rBeg, rEnd, aLineInfo );
+ }
+#else
+ Point aBeg( rDev.LogicToPixel( rBeg ) );
+ Point aEnd( rDev.LogicToPixel( rEnd ) );
+ if( bDotted && (aBeg != aEnd) )
+ {
+ bool bHor = Abs( aEnd.X() - aBeg.X() ) > Abs( aEnd.Y() - aBeg.Y() );
+ const Point& rBegPos( bHor ? ((aBeg.X() < aEnd.X()) ? aBeg : aEnd) : ((aBeg.Y() < aEnd.Y()) ? aBeg : aEnd ) );
+ const Point& rEndPos( (rBegPos == aBeg) ? aEnd : aBeg );
+
+ long nAlongBeg = bHor ? rBegPos.X() : rBegPos.Y();
+ long nAcrssBeg = bHor ? rBegPos.Y() : rBegPos.X();
+ long nAlongSize = (bHor ? rEndPos.X() : rEndPos.Y()) - nAlongBeg;
+ long nAcrssSize = (bHor ? rEndPos.Y() : rEndPos.X()) - nAcrssBeg;
+ double fGradient = static_cast< double >( nAcrssSize ) / nAlongSize;
+
+ PointVec aPoints;
+ aPoints.reserve( (nAlongSize + 1) / 2 );
+ for( long nAlongIdx = 0; nAlongIdx <= nAlongSize; nAlongIdx += 2 )
+ {
+ long nAl = nAlongBeg + nAlongIdx;
+ long nAc = nAcrssBeg + lclD2L( fGradient * nAlongIdx );
+ aPoints.push_back( Point( bHor ? nAl : nAc, bHor ? nAc : nAl ) );
+ }
+
+ rDev.Push( PUSH_MAPMODE );
+ rDev.SetMapMode( MAP_PIXEL );
+ rDev.DrawPixel( lclCreatePolygon( aPoints ) );
+ rDev.Pop(); // map mode
+ }
+#endif
+ else
+ rDev.DrawLine( rBeg, rEnd );
+}
+
+/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
+inline void lclDrawThinLine( OutputDevice& rDev, const LinePoints& rPoints, bool bDotted )
+{
+ lclDrawThinLine( rDev, rPoints.maBeg, rPoints.maEnd, bDotted );
+}
+
+/** Draws a polygon with four points into the passed output device. */
+inline void lclDrawPolygon( OutputDevice& rDev, const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
+{
+ rDev.DrawPolygon( lclCreatePolygon( rP1, rP2, rP3, rP4 ) );
+}
+
+/** Draws a polygon specified by two borders into the passed output device. */
+inline void lclDrawPolygon( OutputDevice& rDev, const LinePoints& rPoints1, const LinePoints& rPoints2 )
+{
+ rDev.DrawPolygon( lclCreatePolygon( rPoints1, rPoints2 ) );
+}
+
+// ============================================================================
+// Drawing of horizontal frame borders.
+
+/** Draws a horizontal thin or thick line into the passed output device.
+
+ The X coordinates of the edges of the line are adjusted according to the
+ passed LineEndResult structs. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawHorLine(
+ OutputDevice& rDev,
+ const Point& rLPos, const LineEndResult& rLRes,
+ const Point& rRPos, const LineEndResult& rRRes,
+ long nTOffs, long nBOffs, bool bDotted )
+{
+ LinePoints aTPoints( rLPos + lclToMapUnit( rLRes.mnOffs1, nTOffs ), rRPos + lclToMapUnit( rRRes.mnOffs1, nTOffs ) );
+ if( nTOffs == nBOffs )
+ lclDrawThinLine( rDev, aTPoints, bDotted );
+ else
+ {
+ LinePoints aBPoints( rLPos + lclToMapUnit( rLRes.mnOffs2, nBOffs ), rRPos + lclToMapUnit( rRRes.mnOffs2, nBOffs ) );
+ lclDrawPolygon( rDev, aTPoints, aBPoints );
+ }
+}
+
+/** Draws a horizontal frame border into the passed output device.
+
+ @param rLPos
+ The top-left or bottom-left reference point of the diagonal frame border.
+ @param rRPos
+ The top-right or bottom-right reference point of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ The X coordinates of the edges of all lines of the frame border are
+ adjusted according to the offsets contained here.
+ */
+void lclDrawHorFrameBorder(
+ OutputDevice& rDev, const Point& rLPos, const Point& rRPos,
+ const Style& rBorder, const BorderResult& rResult, const Color* pForceColor )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawHorFrameBorder - line not visible" );
+ DBG_ASSERT( rLPos.X() <= rRPos.X(), "svx::frame::lclDrawHorFrameBorder - wrong order of line ends" );
+ DBG_ASSERT( rLPos.Y() == rRPos.Y(), "svx::frame::lclDrawHorFrameBorder - line not horizontal" );
+ if( rLPos.X() <= rRPos.X() )
+ {
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawHorLine( rDev, rLPos, rResult.maBeg.maPrim, rRPos, rResult.maEnd.maPrim,
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawHorLine( rDev, rLPos, rResult.maBeg.maSecn, rRPos, rResult.maEnd.maSecn,
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+ }
+}
+
+// ----------------------------------------------------------------------------
+// Drawing of vertical frame borders.
+
+/** Draws a vertical thin or thick line into the passed output device.
+
+ The Y coordinates of the edges of the line are adjusted according to the
+ passed LineEndResult structs. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawVerLine(
+ OutputDevice& rDev,
+ const Point& rTPos, const LineEndResult& rTRes,
+ const Point& rBPos, const LineEndResult& rBRes,
+ long nLOffs, long nROffs, bool bDotted )
+{
+ LinePoints aLPoints( rTPos + lclToMapUnit( nLOffs, rTRes.mnOffs1 ), rBPos + lclToMapUnit( nLOffs, rBRes.mnOffs1 ) );
+ if( nLOffs == nROffs )
+ lclDrawThinLine( rDev, aLPoints, bDotted );
+ else
+ {
+ LinePoints aRPoints( rTPos + lclToMapUnit( nROffs, rTRes.mnOffs2 ), rBPos + lclToMapUnit( nROffs, rBRes.mnOffs2 ) );
+ lclDrawPolygon( rDev, aLPoints, aRPoints );
+ }
+}
+
+/** Draws a vertical frame border into the passed output device.
+
+ @param rTPos
+ The top-left or top-right reference point of the diagonal frame border.
+ @param rBPos
+ The bottom-left or bottom-right reference point of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ The Y coordinates of the edges of all lines of the frame border are
+ adjusted according to the offsets contained here.
+ */
+void lclDrawVerFrameBorder(
+ OutputDevice& rDev, const Point& rTPos, const Point& rBPos,
+ const Style& rBorder, const BorderResult& rResult, const Color* pForceColor )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawVerFrameBorder - line not visible" );
+ DBG_ASSERT( rTPos.Y() <= rBPos.Y(), "svx::frame::lclDrawVerFrameBorder - wrong order of line ends" );
+ DBG_ASSERT( rTPos.X() == rBPos.X(), "svx::frame::lclDrawVerFrameBorder - line not vertical" );
+ if( rTPos.Y() <= rBPos.Y() )
+ {
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawVerLine( rDev, rTPos, rResult.maBeg.maPrim, rBPos, rResult.maEnd.maPrim,
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawVerLine( rDev, rTPos, rResult.maBeg.maSecn, rBPos, rResult.maEnd.maSecn,
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+ }
+}
+
+// ============================================================================
+// Drawing of diagonal frame borders, incudes clipping functions.
+
+/** Returns the drawing coordinates for a diagonal thin line.
+
+ This function can be used for top-left to bottom-right and for bottom-left
+ to top-right lines.
+
+ @param rRect
+ The reference rectangle of the diagonal frame border.
+ @param bTLBR
+ true = top-left to bottom-right; false = bottom-left to top-right.
+ @param nDiagOffs
+ Width offset (sub units) across the diagonal frame border.
+ @return
+ A struct containg start and end position of the diagonal line.
+ */
+LinePoints lclGetDiagLineEnds( const Rectangle& rRect, bool bTLBR, long nDiagOffs )
+{
+ LinePoints aPoints( rRect, bTLBR );
+ bool bVert = rRect.GetWidth() < rRect.GetHeight();
+ double fAngle = bVert ? GetVerDiagAngle( rRect ) : GetHorDiagAngle( rRect );
+ // vertical top-left to bottom-right borders are handled mirrored
+ if( bVert && bTLBR )
+ nDiagOffs = -nDiagOffs;
+ long nTOffs = bTLBR ? GetTLDiagOffset( 0, nDiagOffs, fAngle ) : GetTRDiagOffset( 0, nDiagOffs, fAngle );
+ long nBOffs = bTLBR ? GetBRDiagOffset( 0, nDiagOffs, fAngle ) : GetBLDiagOffset( 0, nDiagOffs, fAngle );
+ // vertical bottom-left to top-right borders are handled with exchanged end points
+ if( bVert && !bTLBR )
+ std::swap( nTOffs, nBOffs );
+ (bVert ? aPoints.maBeg.Y() : aPoints.maBeg.X()) += lclToMapUnit( nTOffs );
+ (bVert ? aPoints.maEnd.Y() : aPoints.maEnd.X()) += lclToMapUnit( nBOffs );
+ return aPoints;
+}
+
+// ----------------------------------------------------------------------------
+// Clipping functions for diagonal frame borders.
+
+/** Limits the clipping region to the inner area of a rectange.
+
+ Takes the values from the passed DiagLineResult struct into account. They
+ may specify to not clip one or more borders of a rectangle.
+
+ @param rDev
+ The output device with the clipping region to be modified. The old
+ clipping region is pushed onto the device's stack and can be restored
+ with a call to OutputDevice::Pop(). Please take care about the correct
+ calling order of Pop() if this function is used with other functions
+ pushing something onto the stack.
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param rResult
+ The result struct containing modifies for each border of the reference
+ rectangle.
+ */
+void lclPushDiagClipRect( OutputDevice& rDev, const Rectangle& rRect, const DiagLineResult& rResult )
+{
+ // PixelToLogic() regards internal offset of the output device
+ Rectangle aClipRect( rRect );
+ aClipRect.Left() += lclToMapUnit( rResult.mnLClip );
+ aClipRect.Top() += lclToMapUnit( rResult.mnTClip );
+ aClipRect.Right() += lclToMapUnit( rResult.mnRClip );
+ aClipRect.Bottom() += lclToMapUnit( rResult.mnBClip );
+ // output device would adjust the rectangle -> invalidate it before
+ if( (aClipRect.GetWidth() < 1) ||(aClipRect.GetHeight() < 1) )
+ aClipRect.SetEmpty();
+
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( aClipRect );
+}
+
+/** Excludes inner area of a crossing double frame border from clipping region.
+
+ This function is used to modify the clipping region so that it excludes the
+ inner free area of a double diagonal frame border. This makes it possible
+ to draw a diagonal frame border in one step without taking care of the
+ crossing double frame border.
+
+ @param rDev
+ The output device with the clipping region to be modified. The old
+ clipping region is pushed onto the device's stack and can be restored
+ with a call to OutputDevice::Pop(). Please take care about the correct
+ calling order of Pop() if this function is used with other functions
+ pushing something onto the stack.
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param bTLBR
+ The orientation of the processed frame border (not the orientation of
+ the crossing frame border).
+ @param bCrossStyle
+ The style of the crossing frame border. Must be a double frame style.
+ */
+void lclPushCrossingClipRegion( OutputDevice& rDev, const Rectangle& rRect, bool bTLBR, const Style& rCrossStyle )
+{
+ DBG_ASSERT( rCrossStyle.Secn(), "lclGetCrossingClipRegion - use only for double styles" );
+ LinePoints aLPoints( lclGetDiagLineEnds( rRect, !bTLBR, lclGetPrimEnd( rCrossStyle ) ) );
+ LinePoints aRPoints( lclGetDiagLineEnds( rRect, !bTLBR, lclGetSecnBeg( rCrossStyle ) ) );
+
+ Region aClipReg;
+ if( bTLBR )
+ {
+ aClipReg = lclCreatePolygon(
+ aLPoints.maBeg, aLPoints.maEnd, rRect.BottomRight(), rRect.BottomLeft(), rRect.TopLeft() );
+ aClipReg.Union( lclCreatePolygon(
+ aRPoints.maBeg, aRPoints.maEnd, rRect.BottomRight(), rRect.TopRight(), rRect.TopLeft() ) );
+ }
+ else
+ {
+ aClipReg = lclCreatePolygon(
+ aLPoints.maBeg, aLPoints.maEnd, rRect.BottomLeft(), rRect.TopLeft(), rRect.TopRight() );
+ aClipReg.Union( lclCreatePolygon(
+ aRPoints.maBeg, aRPoints.maEnd, rRect.BottomLeft(), rRect.BottomRight(), rRect.TopRight() ) );
+ }
+
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( aClipReg );
+}
+
+// ----------------------------------------------------------------------------
+// Drawing functions for diagonal frame borders.
+
+/** Draws a diagonal thin or thick line into the passed output device.
+
+ The clipping region of the output device is modified according to the
+ passed DiagLineResult struct. A one pixel wide line can be drawn dotted.
+ */
+void lclDrawDiagLine(
+ OutputDevice& rDev, const Rectangle& rRect, bool bTLBR,
+ const DiagLineResult& rResult, long nDiagOffs1, long nDiagOffs2, bool bDotted )
+{
+ lclPushDiagClipRect( rDev, rRect, rResult );
+ LinePoints aLPoints( lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs1 ) );
+ if( nDiagOffs1 == nDiagOffs2 )
+ lclDrawThinLine( rDev, aLPoints, bDotted );
+ else
+ lclDrawPolygon( rDev, aLPoints, lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs2 ) );
+ rDev.Pop(); // clipping region
+}
+
+/** Draws a diagonal frame border into the passed output device.
+
+ The lines of the frame border are drawn interrupted, if the style of the
+ crossing frame border is double.
+
+ @param rRect
+ The reference rectangle of the diagonal frame border.
+ @param bTLBR
+ The orientation of the diagonal frame border.
+ @param rBorder
+ The frame style used to draw the border.
+ @param rResult
+ Offsets (sub units) to modify the clipping region of the output device.
+ @param rCrossStyle
+ Style of the crossing diagonal frame border.
+ */
+void lclDrawDiagFrameBorder(
+ OutputDevice& rDev, const Rectangle& rRect, bool bTLBR,
+ const Style& rBorder, const DiagBorderResult& rResult, const Style& rCrossStyle,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ DBG_ASSERT( rBorder.Prim(), "svx::frame::lclDrawDiagFrameBorder - line not visible" );
+
+ bool bClip = bDiagDblClip && rCrossStyle.Secn();
+ if( bClip )
+ lclPushCrossingClipRegion( rDev, rRect, bTLBR, rCrossStyle );
+
+ lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ if( rBorder.Secn() )
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ rDev.Pop(); // colors
+
+ if( bClip )
+ rDev.Pop(); // clipping region
+}
+
+/** Draws both diagonal frame borders into the passed output device.
+
+ The lines of each frame border is drawn interrupted, if the style of the
+ other crossing frame border is double.
+
+ @param rRect
+ The reference rectangle of the diagonal frame borders.
+ @param rTLBR
+ The frame style of the top-left to bottom-right frame border.
+ @param rBLTR
+ The frame style of the bottom-left to top-right frame border.
+ @param rResult
+ Offsets (sub units) to modify the clipping region of the output device.
+ */
+void lclDrawDiagFrameBorders(
+ OutputDevice& rDev, const Rectangle& rRect,
+ const Style& rTLBR, const Style& rBLTR, const DiagBordersResult& rResult,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ DBG_ASSERT( (rRect.GetWidth() > 1) && (rRect.GetHeight() > 1), "svx::frame::lclDrawDiagFrameBorders - rectangle too small" );
+ if( (rRect.GetWidth() > 1) && (rRect.GetHeight() > 1) )
+ {
+ bool bDrawTLBR = rTLBR.Prim() != 0;
+ bool bDrawBLTR = rBLTR.Prim() != 0;
+ bool bFirstDrawBLTR = rTLBR.Secn() != 0;
+
+ if( bDrawBLTR && bFirstDrawBLTR )
+ lclDrawDiagFrameBorder( rDev, rRect, false, rBLTR, rResult.maBLTR, rTLBR, pForceColor, bDiagDblClip );
+ if( bDrawTLBR )
+ lclDrawDiagFrameBorder( rDev, rRect, true, rTLBR, rResult.maTLBR, rBLTR, pForceColor, bDiagDblClip );
+ if( bDrawBLTR && !bFirstDrawBLTR )
+ lclDrawDiagFrameBorder( rDev, rRect, false, rBLTR, rResult.maBLTR, rTLBR, pForceColor, bDiagDblClip );
+ }
+}
+
+// ============================================================================
+
+} // namespace
+
+// ============================================================================
+// Classes
+// ============================================================================
+
+#define SCALEVALUE( value ) lclScaleValue( value, fScale, nMaxWidth )
+
+void Style::Clear()
+{
+ Set( Color(), 0, 0, 0 );
+}
+
+void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
+{
+ /* nP nD nS -> mnPrim mnDist mnSecn
+ --------------------------------------
+ any any 0 nP 0 0
+ 0 any >0 nS 0 0
+ >0 0 >0 nP 0 0
+ >0 >0 >0 nP nD nS
+ */
+ mnPrim = nP ? nP : nS;
+ mnDist = (nP && nS) ? nD : 0;
+ mnSecn = (nP && nD) ? nS : 0;
+}
+
+void Style::Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
+{
+ maColor = rColor;
+ Set( nP, nD, nS );
+}
+
+void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+{
+ maColor = rBorder.GetColor();
+
+ sal_uInt16 nPrim = rBorder.GetOutWidth();
+ sal_uInt16 nDist = rBorder.GetDistance();
+ sal_uInt16 nSecn = rBorder.GetInWidth();
+
+ if( !nSecn ) // no or single frame border
+ {
+ Set( SCALEVALUE( nPrim ), 0, 0 );
+ mbDotted = bUseDots && (0 < nPrim) && (nPrim < 10);
+ }
+ else
+ {
+ Set( SCALEVALUE( nPrim ), SCALEVALUE( nDist ), SCALEVALUE( nSecn ) );
+ mbDotted = false;
+ // Enlarge the style if distance is too small due to rounding losses.
+ sal_uInt16 nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
+ if( nPixWidth > GetWidth() )
+ mnDist = nPixWidth - mnPrim - mnSecn;
+ // Shrink the style if it is too thick for the control.
+ while( GetWidth() > nMaxWidth )
+ {
+ // First decrease space between lines.
+ if( mnDist )
+ --mnDist;
+ // Still too thick? Decrease the line widths.
+ if( GetWidth() > nMaxWidth )
+ {
+ if( mnPrim && (mnPrim == mnSecn) )
+ {
+ // Both lines equal - decrease both to keep symmetry.
+ --mnPrim;
+ --mnSecn;
+ }
+ else
+ {
+ // Decrease each line for itself
+ if( mnPrim )
+ --mnPrim;
+ if( (GetWidth() > nMaxWidth) && mnSecn )
+ --mnSecn;
+ }
+ }
+ }
+ }
+}
+
+void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+{
+ if( pBorder )
+ Set( *pBorder, fScale, nMaxWidth, bUseDots );
+ else
+ {
+ Clear();
+ mbDotted = false;
+ }
+}
+
+Style& Style::ScaleSelf( double fScale, sal_uInt16 nMaxWidth )
+{
+ Set( SCALEVALUE( mnPrim ), SCALEVALUE( mnDist ), SCALEVALUE( mnSecn ) );
+ return *this;
+}
+
+Style Style::Scale( double fScale, sal_uInt16 nMaxWidth ) const
+{
+ return Style( *this ).ScaleSelf( fScale, nMaxWidth );
+}
+
+Style& Style::MirrorSelf()
+{
+ if( mnSecn )
+ std::swap( mnPrim, mnSecn );
+ if( meRefMode != REFMODE_CENTERED )
+ meRefMode = (meRefMode == REFMODE_BEGIN) ? REFMODE_END : REFMODE_BEGIN;
+ return *this;
+}
+
+Style Style::Mirror() const
+{
+ return Style( *this ).MirrorSelf();
+}
+
+bool operator==( const Style& rL, const Style& rR )
+{
+ return (rL.Prim() == rR.Prim()) && (rL.Dist() == rR.Dist()) && (rL.Secn() == rR.Secn()) &&
+ (rL.GetColor() == rR.GetColor()) && (rL.GetRefMode() == rR.GetRefMode()) && (rL.Dotted() == rR.Dotted());
+}
+
+bool operator<( const Style& rL, const Style& rR )
+{
+ // different total widths -> rL<rR, if rL is thinner
+ sal_uInt16 nLW = rL.GetWidth();
+ sal_uInt16 nRW = rR.GetWidth();
+ if( nLW != nRW ) return nLW < nRW;
+
+ // one line double, the other single -> rL<rR, if rL is single
+ if( (rL.Secn() == 0) != (rR.Secn() == 0) ) return rL.Secn() == 0;
+
+ // both lines double with different distances -> rL<rR, if distance of rL greater
+ if( (rL.Secn() && rR.Secn()) && (rL.Dist() != rR.Dist()) ) return rL.Dist() > rR.Dist();
+
+ // both lines single and 1 unit thick, only one is dotted -> rL<rR, if rL is dotted
+ if( (nLW == 1) && (rL.Dotted() != rR.Dotted()) ) return rL.Dotted();
+
+ // seem to be equal
+ return false;
+}
+
+#undef SCALEVALUE
+
+// ============================================================================
+// Various helper functions
+// ============================================================================
+
+double GetHorDiagAngle( long nWidth, long nHeight )
+{
+ return atan2( static_cast< double >( Abs( nHeight ) ), static_cast< double >( Abs( nWidth ) ) );
+}
+
+// ============================================================================
+
+long GetTLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return lclD2L( nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
+}
+
+long GetBLDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return lclD2L( -nVerOffs / tan( fAngle ) + nDiagOffs / sin( fAngle ) );
+}
+
+long GetBRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return -lclD2L( -nVerOffs / tan( fAngle ) - nDiagOffs / sin( fAngle ) );
+}
+
+long GetTRDiagOffset( long nVerOffs, long nDiagOffs, double fAngle )
+{
+ return -lclD2L( nVerOffs / tan( fAngle ) - nDiagOffs / sin( fAngle ) );
+}
+
+// ============================================================================
+
+bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
+ const Style& rTFromTL, const Style& rTFromT, const Style& rTFromTR,
+ const Style& rBFromBL, const Style& rBFromB, const Style& rBFromBR )
+{
+ return // returns 1 AND (2a OR 2b)
+ // 1) only, if both frame borders are equal
+ (rLBorder == rRBorder)
+ &&
+ (
+ (
+ // 2a) if the borders are not double, at least one of the vertical must not be double
+ !rLBorder.Secn() && (!rTFromT.Secn() || !rBFromB.Secn())
+ )
+ ||
+ (
+ // 2b) if the borders are double, all other borders must not be double
+ rLBorder.Secn() &&
+ !rTFromTL.Secn() && !rTFromT.Secn() && !rTFromTR.Secn() &&
+ !rBFromBL.Secn() && !rBFromB.Secn() && !rBFromBR.Secn()
+ )
+ );
+}
+
+// ============================================================================
+// Drawing functions
+// ============================================================================
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
+ const DiagStyle& rRFromTL, const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, const DiagStyle& rRFromBL,
+ const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ {
+ BorderResult aResult;
+ lclLinkHorFrameBorder( aResult, rBorder,
+ rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR,
+ rRFromTL, rRFromT, rRFromR, rRFromB, rRFromBL );
+ lclDrawHorFrameBorder( rDev, rLPos, rRPos, rBorder, aResult, pForceColor );
+ }
+}
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
+ const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
+ const Color* pForceColor )
+{
+ /* Recycle complex version of the DrawHorFrameBorder() function with empty diagonals. */
+ const DiagStyle aNoStyle;
+ DrawHorFrameBorder(
+ rDev, rLPos, rRPos, rBorder,
+ aNoStyle, rLFromT, rLFromL, rLFromB, aNoStyle,
+ aNoStyle, rRFromT, rRFromR, rRFromB, aNoStyle,
+ pForceColor );
+}
+
+void DrawHorFrameBorder( OutputDevice& rDev,
+ const Point& rLPos, const Point& rRPos, const Style& rBorder, const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ lclDrawHorFrameBorder( rDev, rLPos, rRPos, rBorder, BorderResult(), pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder,
+ const DiagStyle& rTFromBL, const Style& rTFromL, const Style& rTFromT, const Style& rTFromR, const DiagStyle& rTFromBR,
+ const DiagStyle& rBFromTL, const Style& rBFromL, const Style& rBFromB, const Style& rBFromR, const DiagStyle& rBFromTR,
+ const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ {
+ BorderResult aResult;
+ lclLinkVerFrameBorder( aResult, rBorder,
+ rTFromBL, rTFromL, rTFromT, rTFromR, rTFromBR,
+ rBFromTL, rBFromL, rBFromB, rBFromR, rBFromTR );
+ lclDrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, aResult, pForceColor );
+ }
+}
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder,
+ const Style& rTFromL, const Style& rTFromT, const Style& rTFromR,
+ const Style& rBFromL, const Style& rBFromB, const Style& rBFromR,
+ const Color* pForceColor )
+{
+ /* Recycle complex version of the DrawVerFrameBorder() function with empty diagonals. */
+ const DiagStyle aNoStyle;
+ DrawVerFrameBorder(
+ rDev, rTPos, rBPos, rBorder,
+ aNoStyle, rTFromL, rTFromT, rTFromR, aNoStyle,
+ aNoStyle, rBFromL, rBFromB, rBFromR, aNoStyle,
+ pForceColor );
+}
+
+void DrawVerFrameBorder( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder, const Color* pForceColor )
+{
+ if( rBorder.Prim() )
+ lclDrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, BorderResult(), pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+void DrawVerFrameBorderSlanted( OutputDevice& rDev,
+ const Point& rTPos, const Point& rBPos, const Style& rBorder, const Color* pForceColor )
+{
+ DBG_ASSERT( rTPos.Y() < rBPos.Y(), "svx::frame::DrawVerFrameBorderSlanted - wrong order of line ends" );
+ if( rBorder.Prim() && (rTPos.Y() < rBPos.Y()) )
+ {
+ if( rTPos.X() == rBPos.X() )
+ {
+ DrawVerFrameBorder( rDev, rTPos, rBPos, rBorder, pForceColor );
+ }
+ else
+ {
+ const LineEndResult aRes;
+
+ Style aScaled( rBorder );
+ aScaled.ScaleSelf( 1.0 / cos( GetVerDiagAngle( rTPos, rBPos ) ) );
+
+ lclSetColorToOutDev( rDev, aScaled, pForceColor );
+ lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
+ lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dotted() );
+ if( aScaled.Secn() )
+ lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
+ lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dotted() );
+ rDev.Pop(); // colors
+ }
+ }
+}
+
+// ============================================================================
+
+void DrawDiagFrameBorders(
+ OutputDevice& rDev, const Rectangle& rRect, const Style& rTLBR, const Style& rBLTR,
+ const Style& rTLFromB, const Style& rTLFromR, const Style& rBRFromT, const Style& rBRFromL,
+ const Style& rBLFromT, const Style& rBLFromR, const Style& rTRFromB, const Style& rTRFromL,
+ const Color* pForceColor, bool bDiagDblClip )
+{
+ if( rTLBR.Prim() || rBLTR.Prim() )
+ {
+ DiagBordersResult aResult;
+ lclLinkDiagFrameBorders( aResult, rTLBR, rBLTR,
+ rTLFromB, rTLFromR, rBRFromT, rBRFromL, rBLFromT, rBLFromR, rTRFromB, rTRFromL );
+ lclDrawDiagFrameBorders( rDev, rRect, rTLBR, rBLTR, aResult, pForceColor, bDiagDblClip );
+ }
+}
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx
new file mode 100644
index 000000000000..a449c778f7b3
--- /dev/null
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -0,0 +1,1247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/framelinkarray.hxx>
+
+#include <math.h>
+#include <vector>
+#include <algorithm>
+#include <vcl/outdev.hxx>
+
+namespace svx {
+namespace frame {
+
+// ============================================================================
+
+
+Cell::Cell() :
+ mnAddLeft( 0 ),
+ mnAddRight( 0 ),
+ mnAddTop( 0 ),
+ mnAddBottom( 0 ),
+ mbMergeOrig( false ),
+ mbOverlapX( false ),
+ mbOverlapY( false )
+{
+}
+
+void Cell::MirrorSelfX( bool bMirrorStyles, bool bSwapDiag )
+{
+ std::swap( maLeft, maRight );
+ std::swap( mnAddLeft, mnAddRight );
+ if( bMirrorStyles )
+ {
+ maLeft.MirrorSelf();
+ maRight.MirrorSelf();
+ }
+ if( bSwapDiag )
+ {
+ std::swap( maTLBR, maBLTR );
+ if( bMirrorStyles )
+ {
+ maTLBR.MirrorSelf();
+ maBLTR.MirrorSelf();
+ }
+ }
+}
+
+void Cell::MirrorSelfY( bool bMirrorStyles, bool bSwapDiag )
+{
+ std::swap( maTop, maBottom );
+ std::swap( mnAddTop, mnAddBottom );
+ if( bMirrorStyles )
+ {
+ maTop.MirrorSelf();
+ maBottom.MirrorSelf();
+ }
+ if( bSwapDiag )
+ std::swap( maTLBR, maBLTR );
+ /* Do not mirror diagonal styles, because they are oriented vertical.
+ Therefore swapping the styles is sufficient for correct behaviour. */
+}
+
+// ----------------------------------------------------------------------------
+
+
+void lclRecalcCoordVec( LongVec& rCoords, const LongVec& rSizes )
+{
+ DBG_ASSERT( rCoords.size() == rSizes.size() + 1, "lclRecalcCoordVec - inconsistent vectors" );
+ LongVec::iterator aCIt = rCoords.begin();
+ LongVec::const_iterator aSIt = rSizes.begin(), aSEnd = rSizes.end();
+ for( ; aSIt != aSEnd; ++aCIt, ++aSIt )
+ *(aCIt + 1) = *aCIt + *aSIt;
+}
+
+void lclSetMergedRange( CellVec& rCells, size_t nWidth, size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ for( size_t nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ for( size_t nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ Cell& rCell = rCells[ nRow * nWidth + nCol ];
+ rCell.mbMergeOrig = false;
+ rCell.mbOverlapX = nCol > nFirstCol;
+ rCell.mbOverlapY = nRow > nFirstRow;
+ }
+ }
+ rCells[ nFirstRow * nWidth + nFirstCol ].mbMergeOrig = true;
+}
+
+// ----------------------------------------------------------------------------
+
+static const Style OBJ_STYLE_NONE;
+static const Cell OBJ_CELL_NONE;
+
+const bool DIAG_DBL_CLIP_DEFAULT = false;
+
+// ============================================================================
+
+ArrayImpl::ArrayImpl( size_t nWidth, size_t nHeight, bool bDiagDblClip ) :
+ mnWidth( nWidth ),
+ mnHeight( nHeight ),
+ mnFirstClipCol( 0 ),
+ mnFirstClipRow( 0 ),
+ mnLastClipCol( nWidth - 1 ),
+ mnLastClipRow( nHeight - 1 ),
+ mbXCoordsDirty( false ),
+ mbYCoordsDirty( false ),
+ mbDiagDblClip( bDiagDblClip )
+{
+ // default-construct all vectors
+ maCells.resize( mnWidth * mnHeight );
+ maWidths.resize( mnWidth, 0L );
+ maHeights.resize( mnHeight, 0L );
+ maXCoords.resize( mnWidth + 1, 0L );
+ maYCoords.resize( mnHeight + 1, 0L );
+}
+
+const Cell& ArrayImpl::GetCell( size_t nCol, size_t nRow ) const
+{
+ return IsValidPos( nCol, nRow ) ? maCells[ GetIndex( nCol, nRow ) ] : OBJ_CELL_NONE;
+}
+
+Cell& ArrayImpl::GetCellAcc( size_t nCol, size_t nRow )
+{
+ static Cell aDummy;
+ return IsValidPos( nCol, nRow ) ? maCells[ GetIndex( nCol, nRow ) ] : aDummy;
+}
+
+size_t ArrayImpl::GetMergedFirstCol( size_t nCol, size_t nRow ) const
+{
+ size_t nFirstCol = nCol;
+ while( (nFirstCol > 0) && GetCell( nFirstCol, nRow ).mbOverlapX ) --nFirstCol;
+ return nFirstCol;
+}
+
+size_t ArrayImpl::GetMergedFirstRow( size_t nCol, size_t nRow ) const
+{
+ size_t nFirstRow = nRow;
+ while( (nFirstRow > 0) && GetCell( nCol, nFirstRow ).mbOverlapY ) --nFirstRow;
+ return nFirstRow;
+}
+
+size_t ArrayImpl::GetMergedLastCol( size_t nCol, size_t nRow ) const
+{
+ size_t nLastCol = nCol + 1;
+ while( (nLastCol < mnWidth) && GetCell( nLastCol, nRow ).mbOverlapX ) ++nLastCol;
+ return nLastCol - 1;
+}
+
+size_t ArrayImpl::GetMergedLastRow( size_t nCol, size_t nRow ) const
+{
+ size_t nLastRow = nRow + 1;
+ while( (nLastRow < mnHeight) && GetCell( nCol, nLastRow ).mbOverlapY ) ++nLastRow;
+ return nLastRow - 1;
+}
+
+const Cell& ArrayImpl::GetMergedOriginCell( size_t nCol, size_t nRow ) const
+{
+ return GetCell( GetMergedFirstCol( nCol, nRow ), GetMergedFirstRow( nCol, nRow ) );
+}
+
+Cell& ArrayImpl::GetMergedOriginCellAcc( size_t nCol, size_t nRow )
+{
+ return GetCellAcc( GetMergedFirstCol( nCol, nRow ), GetMergedFirstRow( nCol, nRow ) );
+}
+
+bool ArrayImpl::IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const
+{
+ const Cell& rCell = GetCell( nCol, nRow );
+ return rCell.mbOverlapX || (rCell.mnAddLeft > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedRight( size_t nCol, size_t nRow ) const
+{
+ return GetCell( nCol + 1, nRow ).mbOverlapX || (GetCell( nCol, nRow ).mnAddRight > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedTop( size_t nCol, size_t nRow ) const
+{
+ const Cell& rCell = GetCell( nCol, nRow );
+ return rCell.mbOverlapY || (rCell.mnAddTop > 0);
+}
+
+bool ArrayImpl::IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const
+{
+ return GetCell( nCol, nRow + 1 ).mbOverlapY || (GetCell( nCol, nRow ).mnAddBottom > 0);
+}
+
+bool ArrayImpl::IsColInClipRange( size_t nCol ) const
+{
+ return (mnFirstClipCol <= nCol) && (nCol <= mnLastClipCol);
+}
+
+bool ArrayImpl::IsRowInClipRange( size_t nRow ) const
+{
+ return (mnFirstClipRow <= nRow) && (nRow <= mnLastClipRow);
+}
+
+bool ArrayImpl::IsInClipRange( size_t nCol, size_t nRow ) const
+{
+ return IsColInClipRange( nCol ) && IsRowInClipRange( nRow );
+}
+
+long ArrayImpl::GetColPosition( size_t nCol ) const
+{
+ if( mbXCoordsDirty )
+ {
+ lclRecalcCoordVec( maXCoords, maWidths );
+ mbXCoordsDirty = false;
+ }
+ return maXCoords[ nCol ];
+}
+
+long ArrayImpl::GetRowPosition( size_t nRow ) const
+{
+ if( mbYCoordsDirty )
+ {
+ lclRecalcCoordVec( maYCoords, maHeights );
+ mbYCoordsDirty = false;
+ }
+ return maYCoords[ nRow ];
+}
+
+long ArrayImpl::GetColWidth( size_t nFirstCol, size_t nLastCol ) const
+{
+ return GetColPosition( nLastCol + 1 ) - GetColPosition( nFirstCol );
+}
+
+long ArrayImpl::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
+{
+ return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
+}
+
+double ArrayImpl::GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ double fAngle = 0.0;
+ if( IsValidPos( nCol, nRow ) )
+ {
+ if( bSimple || !GetCell( nCol, nRow ).IsMerged() )
+ {
+ fAngle = frame::GetHorDiagAngle( maWidths[ nCol ] + 1, maHeights[ nRow ] + 1 );
+ }
+ else
+ {
+ // return correct angle for each cell in the merged range
+ size_t nFirstCol = GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = GetMergedFirstRow( nCol, nRow );
+ const Cell& rCell = GetCell( nFirstCol, nFirstRow );
+ long nWidth = GetColWidth( nFirstCol, GetMergedLastCol( nCol, nRow ) ) + rCell.mnAddLeft + rCell.mnAddRight;
+ long nHeight = GetRowHeight( nFirstRow, GetMergedLastRow( nCol, nRow ) ) + rCell.mnAddTop + rCell.mnAddBottom;
+ fAngle = frame::GetHorDiagAngle( nWidth + 1, nHeight + 1 );
+ }
+ }
+ return fAngle;
+}
+
+double ArrayImpl::GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ double fAngle = GetHorDiagAngle( nCol, nRow, bSimple );
+ return (fAngle > 0.0) ? (F_PI2 - fAngle) : 0.0;
+}
+
+// ============================================================================
+
+class MergedCellIterator
+{
+public:
+ explicit MergedCellIterator( const Array& rArray, size_t nCol, size_t nRow );
+
+ inline bool Is() const { return (mnCol <= mnLastCol) && (mnRow <= mnLastRow); }
+ inline size_t Col() const { return mnCol; }
+ inline size_t Row() const { return mnRow; }
+
+ MergedCellIterator& operator++();
+
+private:
+ size_t mnFirstCol;
+ size_t mnFirstRow;
+ size_t mnLastCol;
+ size_t mnLastRow;
+ size_t mnCol;
+ size_t mnRow;
+};
+
+// ----------------------------------------------------------------------------
+
+MergedCellIterator::MergedCellIterator( const Array& rArray, size_t nCol, size_t nRow )
+{
+ DBG_ASSERT( rArray.IsMerged( nCol, nRow ), "svx::frame::MergedCellIterator::MergedCellIterator - not in merged range" );
+ rArray.GetMergedRange( mnFirstCol, mnFirstRow, mnLastCol, mnLastRow, nCol, nRow );
+ mnCol = mnFirstCol;
+ mnRow = mnFirstRow;
+}
+
+MergedCellIterator& MergedCellIterator::operator++()
+{
+ DBG_ASSERT( Is(), "svx::frame::MergedCellIterator::operator++() - already invalid" );
+ if( ++mnCol > mnLastCol )
+ {
+ mnCol = mnFirstCol;
+ ++mnRow;
+ }
+ return *this;
+}
+
+// ============================================================================
+
+#define DBG_FRAME_ERROR( funcname, error ) DBG_ERRORFILE( "svx::frame::Array::" funcname " - " error )
+#define DBG_FRAME_CHECK( cond, funcname, error ) DBG_ASSERT( cond, "svx::frame::Array::" funcname " - " error )
+#define DBG_FRAME_CHECK_COL( col, funcname ) DBG_FRAME_CHECK( (col) < GetColCount(), funcname, "invalid column index" )
+#define DBG_FRAME_CHECK_ROW( row, funcname ) DBG_FRAME_CHECK( (row) < GetRowCount(), funcname, "invalid row index" )
+#define DBG_FRAME_CHECK_COLROW( col, row, funcname ) DBG_FRAME_CHECK( ((col) < GetColCount()) && ((row) < GetRowCount()), funcname, "invalid cell index" )
+#define DBG_FRAME_CHECK_INDEX( index, funcname ) DBG_FRAME_CHECK( (index) < GetCellCount(), funcname, "invalid cell index" )
+#define DBG_FRAME_CHECK_COL_1( col, funcname ) DBG_FRAME_CHECK( (col) <= GetColCount(), funcname, "invalid column index" )
+#define DBG_FRAME_CHECK_ROW_1( row, funcname ) DBG_FRAME_CHECK( (row) <= GetRowCount(), funcname, "invalid row index" )
+
+// ----------------------------------------------------------------------------
+
+#define CELL( col, row ) mxImpl->GetCell( col, row )
+#define CELLACC( col, row ) mxImpl->GetCellAcc( col, row )
+#define ORIGCELL( col, row ) mxImpl->GetMergedOriginCell( col, row )
+#define ORIGCELLACC( col, row ) mxImpl->GetMergedOriginCellAcc( col, row )
+
+// ----------------------------------------------------------------------------
+
+Array::Array()
+{
+ Initialize( 0, 0 );
+}
+
+Array::Array( size_t nWidth, size_t nHeight )
+{
+ Initialize( nWidth, nHeight );
+}
+
+Array::~Array()
+{
+}
+
+// array size and column/row indexes ------------------------------------------
+
+void Array::Initialize( size_t nWidth, size_t nHeight )
+{
+ bool bDiagDblClip = mxImpl.get() ? mxImpl->mbDiagDblClip : DIAG_DBL_CLIP_DEFAULT;
+ mxImpl.reset( new ArrayImpl( nWidth, nHeight, bDiagDblClip ) );
+}
+
+void Array::Clear()
+{
+ Initialize( mxImpl->mnWidth, mxImpl->mnHeight );
+}
+
+size_t Array::GetColCount() const
+{
+ return mxImpl->mnWidth;
+}
+
+size_t Array::GetRowCount() const
+{
+ return mxImpl->mnHeight;
+}
+
+size_t Array::GetCellCount() const
+{
+ return mxImpl->maCells.size();
+}
+
+size_t Array::GetColFromIndex( size_t nCellIndex ) const
+{
+ DBG_FRAME_CHECK_INDEX( nCellIndex, "GetColFromIndex" );
+ return mxImpl->mnWidth ? (nCellIndex % mxImpl->mnWidth) : 0;
+}
+
+size_t Array::GetRowFromIndex( size_t nCellIndex ) const
+{
+ DBG_FRAME_CHECK_INDEX( nCellIndex, "GetRowFromIndex" );
+ return mxImpl->mnWidth ? (nCellIndex / mxImpl->mnWidth) : 0;
+}
+
+size_t Array::GetCellIndex( size_t nCol, size_t nRow, bool bRTL ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetCellIndex" );
+ if (bRTL)
+ nCol = mxImpl->GetMirrorCol(nCol);
+ return mxImpl->GetIndex( nCol, nRow );
+}
+
+// cell border styles ---------------------------------------------------------
+
+void Array::SetCellStyleLeft( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleLeft" );
+ CELLACC( nCol, nRow ).maLeft = rStyle;
+}
+
+void Array::SetCellStyleRight( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleRight" );
+ CELLACC( nCol, nRow ).maRight = rStyle;
+}
+
+void Array::SetCellStyleTop( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleTop" );
+ CELLACC( nCol, nRow ).maTop = rStyle;
+}
+
+void Array::SetCellStyleBottom( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleBottom" );
+ CELLACC( nCol, nRow ).maBottom = rStyle;
+}
+
+void Array::SetCellStyleTLBR( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleTLBR" );
+ CELLACC( nCol, nRow ).maTLBR = rStyle;
+}
+
+void Array::SetCellStyleBLTR( size_t nCol, size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleBLTR" );
+ CELLACC( nCol, nRow ).maBLTR = rStyle;
+}
+
+void Array::SetCellStyleDiag( size_t nCol, size_t nRow, const Style& rTLBR, const Style& rBLTR )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetCellStyleDiag" );
+ Cell& rCell = CELLACC( nCol, nRow );
+ rCell.maTLBR = rTLBR;
+ rCell.maBLTR = rBLTR;
+}
+
+void Array::SetColumnStyleLeft( size_t nCol, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColumnStyleLeft" );
+ for( size_t nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ SetCellStyleLeft( nCol, nRow, rStyle );
+}
+
+void Array::SetColumnStyleRight( size_t nCol, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColumnStyleRight" );
+ for( size_t nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ SetCellStyleRight( nCol, nRow, rStyle );
+}
+
+void Array::SetRowStyleTop( size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowStyleTop" );
+ for( size_t nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ SetCellStyleTop( nCol, nRow, rStyle );
+}
+
+void Array::SetRowStyleBottom( size_t nRow, const Style& rStyle )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowStyleBottom" );
+ for( size_t nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ SetCellStyleBottom( nCol, nRow, rStyle );
+}
+
+const Style& Array::GetCellStyleLeft( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own left style
+ if( bSimple )
+ return CELL( nCol, nRow ).maLeft;
+ // outside clipping rows or overlapped in merged cells: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) || mxImpl->IsMergedOverlappedLeft( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // left clipping border: always own left style
+ if( nCol == mxImpl->mnFirstClipCol )
+ return ORIGCELL( nCol, nRow ).maLeft;
+ // right clipping border: always right style of left neighbor cell
+ if( nCol == mxImpl->mnLastClipCol + 1 )
+ return ORIGCELL( nCol - 1, nRow ).maRight;
+ // outside clipping columns: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own left style and right style of left neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maLeft, ORIGCELL( nCol - 1, nRow ).maRight );
+}
+
+const Style& Array::GetCellStyleRight( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own right style
+ if( bSimple )
+ return CELL( nCol, nRow ).maRight;
+ // outside clipping rows or overlapped in merged cells: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) || mxImpl->IsMergedOverlappedRight( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // left clipping border: always left style of right neighbor cell
+ if( nCol + 1 == mxImpl->mnFirstClipCol )
+ return ORIGCELL( nCol + 1, nRow ).maLeft;
+ // right clipping border: always own right style
+ if( nCol == mxImpl->mnLastClipCol )
+ return ORIGCELL( nCol, nRow ).maRight;
+ // outside clipping columns: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own right style and left style of right neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maRight, ORIGCELL( nCol + 1, nRow ).maLeft );
+}
+
+const Style& Array::GetCellStyleTop( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own top style
+ if( bSimple )
+ return CELL( nCol, nRow ).maTop;
+ // outside clipping columns or overlapped in merged cells: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) || mxImpl->IsMergedOverlappedTop( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // top clipping border: always own top style
+ if( nRow == mxImpl->mnFirstClipRow )
+ return ORIGCELL( nCol, nRow ).maTop;
+ // bottom clipping border: always bottom style of top neighbor cell
+ if( nRow == mxImpl->mnLastClipRow + 1 )
+ return ORIGCELL( nCol, nRow - 1 ).maBottom;
+ // outside clipping rows: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own top style and bottom style of top neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maTop, ORIGCELL( nCol, nRow - 1 ).maBottom );
+}
+
+const Style& Array::GetCellStyleBottom( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ // simple: always return own bottom style
+ if( bSimple )
+ return CELL( nCol, nRow ).maBottom;
+ // outside clipping columns or overlapped in merged cells: invisible
+ if( !mxImpl->IsColInClipRange( nCol ) || mxImpl->IsMergedOverlappedBottom( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // top clipping border: always top style of bottom neighbor cell
+ if( nRow + 1 == mxImpl->mnFirstClipRow )
+ return ORIGCELL( nCol, nRow + 1 ).maTop;
+ // bottom clipping border: always own bottom style
+ if( nRow == mxImpl->mnLastClipRow )
+ return ORIGCELL( nCol, nRow ).maBottom;
+ // outside clipping rows: invisible
+ if( !mxImpl->IsRowInClipRange( nRow ) )
+ return OBJ_STYLE_NONE;
+ // inside clipping range: maximum of own bottom style and top style of bottom neighbor cell
+ return std::max( ORIGCELL( nCol, nRow ).maBottom, ORIGCELL( nCol, nRow + 1 ).maTop );
+}
+
+const Style& Array::GetCellStyleTLBR( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ return bSimple ? CELL( nCol, nRow ).maTLBR :
+ (mxImpl->IsInClipRange( nCol, nRow ) ? ORIGCELL( nCol, nRow ).maTLBR : OBJ_STYLE_NONE);
+}
+
+const Style& Array::GetCellStyleBLTR( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ return bSimple ? CELL( nCol, nRow ).maBLTR :
+ (mxImpl->IsInClipRange( nCol, nRow ) ? ORIGCELL( nCol, nRow ).maBLTR : OBJ_STYLE_NONE);
+}
+
+const Style& Array::GetCellStyleTL( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for top-left cell
+ size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ return ((nCol == nFirstCol) && (nRow == nFirstRow)) ?
+ CELL( nFirstCol, nFirstRow ).maTLBR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleBR( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for bottom-right cell
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ return ((nCol == nLastCol) && (nRow == nLastRow)) ?
+ CELL( mxImpl->GetMergedFirstCol( nCol, nRow ), mxImpl->GetMergedFirstRow( nCol, nRow ) ).maTLBR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleBL( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for bottom-left cell
+ size_t nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ return ((nCol == nFirstCol) && (nRow == nLastRow)) ?
+ CELL( nFirstCol, mxImpl->GetMergedFirstRow( nCol, nRow ) ).maBLTR : OBJ_STYLE_NONE;
+}
+
+const Style& Array::GetCellStyleTR( size_t nCol, size_t nRow ) const
+{
+ // not in clipping range: always invisible
+ if( !mxImpl->IsInClipRange( nCol, nRow ) )
+ return OBJ_STYLE_NONE;
+ // return style only for top-right cell
+ size_t nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ return ((nCol == nLastCol) && (nRow == nFirstRow)) ?
+ CELL( mxImpl->GetMergedFirstCol( nCol, nRow ), nFirstRow ).maBLTR : OBJ_STYLE_NONE;
+}
+
+// cell merging ---------------------------------------------------------------
+
+void Array::SetMergedRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "SetMergedRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "SetMergedRange" );
+#if OSL_DEBUG_LEVEL >= 2
+ {
+ bool bFound = false;
+ for( size_t nCurrCol = nFirstCol; !bFound && (nCurrCol <= nLastCol); ++nCurrCol )
+ for( size_t nCurrRow = nFirstRow; !bFound && (nCurrRow <= nLastRow); ++nCurrRow )
+ bFound = CELL( nCurrCol, nCurrRow ).IsMerged();
+ DBG_FRAME_CHECK( !bFound, "SetMergedRange", "overlapping merged ranges" );
+ }
+#endif
+ if( mxImpl->IsValidPos( nFirstCol, nFirstRow ) && mxImpl->IsValidPos( nLastCol, nLastRow ) )
+ lclSetMergedRange( mxImpl->maCells, mxImpl->mnWidth, nFirstCol, nFirstRow, nLastCol, nLastRow );
+}
+
+void Array::RemoveMergedRange( size_t nCol, size_t nRow )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "RemoveMergedRange" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ {
+ Cell& rCell = CELLACC( aIt.Col(), aIt.Row() );
+ rCell.mbMergeOrig = rCell.mbOverlapX = rCell.mbOverlapY = false;
+ rCell.mnAddLeft = rCell.mnAddRight = rCell.mnAddTop = rCell.mnAddBottom = 0;
+ }
+}
+
+void Array::SetAddMergedLeftSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedLeftSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedFirstCol( nCol, nRow ) == 0, "SetAddMergedLeftSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddLeft = nAddSize;
+}
+
+void Array::SetAddMergedRightSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedRightSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedLastCol( nCol, nRow ) + 1 == mxImpl->mnWidth, "SetAddMergedRightSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddRight = nAddSize;
+}
+
+void Array::SetAddMergedTopSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedTopSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedFirstRow( nCol, nRow ) == 0, "SetAddMergedTopSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddTop = nAddSize;
+}
+
+void Array::SetAddMergedBottomSize( size_t nCol, size_t nRow, long nAddSize )
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "SetAddMergedBottomSize" );
+ DBG_FRAME_CHECK( mxImpl->GetMergedLastRow( nCol, nRow ) + 1 == mxImpl->mnHeight, "SetAddMergedBottomSize", "additional border inside array" );
+ for( MergedCellIterator aIt( *this, nCol, nRow ); aIt.Is(); ++aIt )
+ CELLACC( aIt.Col(), aIt.Row() ).mnAddBottom = nAddSize;
+}
+
+bool Array::IsMerged( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMerged" );
+ return CELL( nCol, nRow ).IsMerged();
+}
+
+bool Array::IsMergedOrigin( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOrigin" );
+ return CELL( nCol, nRow ).mbMergeOrig;
+}
+
+bool Array::IsMergedOverlapped( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlapped" );
+ return CELL( nCol, nRow ).IsOverlapped();
+}
+
+bool Array::IsMergedOverlappedLeft( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedLeft" );
+ return mxImpl->IsMergedOverlappedLeft( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedRight( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedRight" );
+ return mxImpl->IsMergedOverlappedRight( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedTop( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedTop" );
+ return mxImpl->IsMergedOverlappedTop( nCol, nRow );
+}
+
+bool Array::IsMergedOverlappedBottom( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsMergedOverlappedBottom" );
+ return mxImpl->IsMergedOverlappedBottom( nCol, nRow );
+}
+
+void Array::GetMergedOrigin( size_t& rnFirstCol, size_t& rnFirstRow, size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetMergedOrigin" );
+ rnFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ rnFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+}
+
+void Array::GetMergedSize( size_t& rnWidth, size_t& rnHeight, size_t nCol, size_t nRow ) const
+{
+ size_t nFirstCol, nFirstRow, nLastCol, nLastRow;
+ GetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow, nCol, nRow );
+ rnWidth = nLastCol - nFirstCol + 1;
+ rnHeight = nLastRow - nFirstRow + 1;
+}
+
+void Array::GetMergedRange( size_t& rnFirstCol, size_t& rnFirstRow,
+ size_t& rnLastCol, size_t& rnLastRow, size_t nCol, size_t nRow ) const
+{
+ GetMergedOrigin( rnFirstCol, rnFirstRow, nCol, nRow );
+ rnLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ rnLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+}
+
+// clipping -------------------------------------------------------------------
+
+void Array::SetClipRange( size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow )
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "SetClipRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "SetClipRange" );
+ mxImpl->mnFirstClipCol = nFirstCol;
+ mxImpl->mnFirstClipRow = nFirstRow;
+ mxImpl->mnLastClipCol = nLastCol;
+ mxImpl->mnLastClipRow = nLastRow;
+}
+
+void Array::RemoveClipRange()
+{
+ if( !mxImpl->maCells.empty() )
+ SetClipRange( 0, 0, mxImpl->mnWidth - 1, mxImpl->mnHeight - 1 );
+}
+
+bool Array::IsInClipRange( size_t nCol, size_t nRow ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "IsInClipRange" );
+ return mxImpl->IsInClipRange( nCol, nRow );
+}
+
+Rectangle Array::GetClipRangeRectangle() const
+{
+ return Rectangle(
+ mxImpl->GetColPosition( mxImpl->mnFirstClipCol ),
+ mxImpl->GetRowPosition( mxImpl->mnFirstClipRow ),
+ mxImpl->GetColPosition( mxImpl->mnLastClipCol + 1 ),
+ mxImpl->GetRowPosition( mxImpl->mnLastClipRow + 1 ) );
+}
+
+// cell coordinates -----------------------------------------------------------
+
+void Array::SetXOffset( long nXOffset )
+{
+ mxImpl->maXCoords[ 0 ] = nXOffset;
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetYOffset( long nYOffset )
+{
+ mxImpl->maYCoords[ 0 ] = nYOffset;
+ mxImpl->mbYCoordsDirty = true;
+}
+
+void Array::SetColWidth( size_t nCol, long nWidth )
+{
+ DBG_FRAME_CHECK_COL( nCol, "SetColWidth" );
+ mxImpl->maWidths[ nCol ] = nWidth;
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetRowHeight( size_t nRow, long nHeight )
+{
+ DBG_FRAME_CHECK_ROW( nRow, "SetRowHeight" );
+ mxImpl->maHeights[ nRow ] = nHeight;
+ mxImpl->mbYCoordsDirty = true;
+}
+
+void Array::SetAllColWidths( long nWidth )
+{
+ std::fill( mxImpl->maWidths.begin(), mxImpl->maWidths.end(), nWidth );
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::SetAllRowHeights( long nHeight )
+{
+ std::fill( mxImpl->maHeights.begin(), mxImpl->maHeights.end(), nHeight );
+ mxImpl->mbYCoordsDirty = true;
+}
+
+long Array::GetColPosition( size_t nCol ) const
+{
+ DBG_FRAME_CHECK_COL_1( nCol, "GetColPosition" );
+ return mxImpl->GetColPosition( nCol );
+}
+
+long Array::GetRowPosition( size_t nRow ) const
+{
+ DBG_FRAME_CHECK_ROW_1( nRow, "GetRowPosition" );
+ return mxImpl->GetRowPosition( nRow );
+}
+
+long Array::GetColWidth( size_t nCol ) const
+{
+ DBG_FRAME_CHECK_COL( nCol, "GetColWidth" );
+ return mxImpl->maWidths[ nCol ];
+}
+
+long Array::GetColWidth( size_t nFirstCol, size_t nLastCol ) const
+{
+ DBG_FRAME_CHECK_COL( nFirstCol, "GetColWidth" );
+ DBG_FRAME_CHECK_COL( nLastCol, "GetColWidth" );
+ return GetColPosition( nLastCol + 1 ) - GetColPosition( nFirstCol );
+}
+
+long Array::GetRowHeight( size_t nRow ) const
+{
+ DBG_FRAME_CHECK_ROW( nRow, "GetRowHeight" );
+ return mxImpl->maHeights[ nRow ];
+}
+
+long Array::GetRowHeight( size_t nFirstRow, size_t nLastRow ) const
+{
+ DBG_FRAME_CHECK_ROW( nFirstRow, "GetRowHeight" );
+ DBG_FRAME_CHECK_ROW( nLastRow, "GetRowHeight" );
+ return GetRowPosition( nLastRow + 1 ) - GetRowPosition( nFirstRow );
+}
+
+long Array::GetWidth() const
+{
+ return GetColPosition( mxImpl->mnWidth ) - GetColPosition( 0 );
+}
+
+long Array::GetHeight() const
+{
+ return GetRowPosition( mxImpl->mnHeight ) - GetRowPosition( 0 );
+}
+
+Point Array::GetCellPosition( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ size_t nFirstCol = bSimple ? nCol : mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = bSimple ? nRow : mxImpl->GetMergedFirstRow( nCol, nRow );
+ return Point( GetColPosition( nFirstCol ), GetRowPosition( nFirstRow ) );
+}
+
+Size Array::GetCellSize( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ size_t nFirstCol = bSimple ? nCol : mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t nFirstRow = bSimple ? nRow : mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t nLastCol = bSimple ? nCol : mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = bSimple ? nRow : mxImpl->GetMergedLastRow( nCol, nRow );
+ return Size( GetColWidth( nFirstCol, nLastCol ) + 1, GetRowHeight( nFirstRow, nLastRow ) + 1 );
+}
+
+Rectangle Array::GetCellRect( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ Rectangle aRect( GetCellPosition( nCol, nRow, bSimple ), GetCellSize( nCol, nRow, bSimple ) );
+
+ // adjust rectangle for partly visible merged cells
+ const Cell& rCell = CELL( nCol, nRow );
+ if( !bSimple && rCell.IsMerged() )
+ {
+ aRect.Left() -= rCell.mnAddLeft;
+ aRect.Right() += rCell.mnAddRight;
+ aRect.Top() -= rCell.mnAddTop;
+ aRect.Bottom() += rCell.mnAddBottom;
+ }
+ return aRect;
+}
+
+// diagonal frame borders -----------------------------------------------------
+
+double Array::GetHorDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetHorDiagAngle" );
+ return mxImpl->GetHorDiagAngle( nCol, nRow, bSimple );
+}
+
+double Array::GetVerDiagAngle( size_t nCol, size_t nRow, bool bSimple ) const
+{
+ DBG_FRAME_CHECK_COLROW( nCol, nRow, "GetVerDiagAngle" );
+ return mxImpl->GetVerDiagAngle( nCol, nRow, bSimple );
+}
+
+void Array::SetUseDiagDoubleClipping( bool bSet )
+{
+ mxImpl->mbDiagDblClip = bSet;
+}
+
+bool Array::GetUseDiagDoubleClipping() const
+{
+ return mxImpl->mbDiagDblClip;
+}
+
+// mirroring ------------------------------------------------------------------
+
+void Array::MirrorSelfX( bool bMirrorStyles, bool bSwapDiag )
+{
+ CellVec aNewCells;
+ aNewCells.reserve( GetCellCount() );
+
+ size_t nCol, nRow;
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ aNewCells.push_back( CELL( mxImpl->GetMirrorCol( nCol ), nRow ) );
+ aNewCells.back().MirrorSelfX( bMirrorStyles, bSwapDiag );
+ }
+ }
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ if( CELL( nCol, nRow ).mbMergeOrig )
+ {
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ lclSetMergedRange( aNewCells, mxImpl->mnWidth,
+ mxImpl->GetMirrorCol( nLastCol ), nRow,
+ mxImpl->GetMirrorCol( nCol ), nLastRow );
+ }
+ }
+ }
+ mxImpl->maCells.swap( aNewCells );
+
+ std::reverse( mxImpl->maWidths.begin(), mxImpl->maWidths.end() );
+ mxImpl->mbXCoordsDirty = true;
+}
+
+void Array::MirrorSelfY( bool bMirrorStyles, bool bSwapDiag )
+{
+ CellVec aNewCells;
+ aNewCells.reserve( GetCellCount() );
+
+ size_t nCol, nRow;
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ aNewCells.push_back( CELL( nCol, mxImpl->GetMirrorRow( nRow ) ) );
+ aNewCells.back().MirrorSelfY( bMirrorStyles, bSwapDiag );
+ }
+ }
+ for( nRow = 0; nRow < mxImpl->mnHeight; ++nRow )
+ {
+ for( nCol = 0; nCol < mxImpl->mnWidth; ++nCol )
+ {
+ if( CELL( nCol, nRow ).mbMergeOrig )
+ {
+ size_t nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+ lclSetMergedRange( aNewCells, mxImpl->mnWidth,
+ nCol, mxImpl->GetMirrorRow( nLastRow ),
+ nLastCol, mxImpl->GetMirrorRow( nRow ) );
+ }
+ }
+ }
+ mxImpl->maCells.swap( aNewCells );
+
+ std::reverse( mxImpl->maHeights.begin(), mxImpl->maHeights.end() );
+ mxImpl->mbYCoordsDirty = true;
+}
+
+// drawing --------------------------------------------------------------------
+
+void Array::DrawCell( OutputDevice& rDev, size_t nCol, size_t nRow, const Color* pForceColor ) const
+{
+ DrawRange( rDev, nCol, nRow, nCol, nRow, pForceColor );
+}
+
+void Array::DrawRange( OutputDevice& rDev,
+ size_t nFirstCol, size_t nFirstRow, size_t nLastCol, size_t nLastRow,
+ const Color* pForceColor ) const
+{
+ DBG_FRAME_CHECK_COLROW( nFirstCol, nFirstRow, "DrawRange" );
+ DBG_FRAME_CHECK_COLROW( nLastCol, nLastRow, "DrawRange" );
+
+ size_t nCol, nRow;
+
+ // *** diagonal frame borders ***
+
+ // set clipping region to clip partly visible merged cells
+ rDev.Push( PUSH_CLIPREGION );
+ rDev.IntersectClipRegion( GetClipRangeRectangle() );
+ for( nRow = nFirstRow; nRow <= nLastRow; ++nRow )
+ {
+ for( nCol = nFirstCol; nCol <= nLastCol; ++nCol )
+ {
+ const Cell& rCell = CELL( nCol, nRow );
+ bool bOverlapX = rCell.mbOverlapX;
+ bool bOverlapY = rCell.mbOverlapY;
+ bool bFirstCol = nCol == nFirstCol;
+ bool bFirstRow = nRow == nFirstRow;
+ if( (!bOverlapX && !bOverlapY) || (bFirstCol && bFirstRow) ||
+ (!bOverlapY && bFirstCol) || (!bOverlapX && bFirstRow) )
+ {
+ Rectangle aRect( GetCellRect( nCol, nRow ) );
+ if( (aRect.GetWidth() > 1) && (aRect.GetHeight() > 1) )
+ {
+ size_t _nFirstCol = mxImpl->GetMergedFirstCol( nCol, nRow );
+ size_t _nFirstRow = mxImpl->GetMergedFirstRow( nCol, nRow );
+ size_t _nLastCol = mxImpl->GetMergedLastCol( nCol, nRow );
+ size_t _nLastRow = mxImpl->GetMergedLastRow( nCol, nRow );
+
+ DrawDiagFrameBorders( rDev, aRect,
+ GetCellStyleTLBR( _nFirstCol, _nFirstRow, true ), GetCellStyleBLTR( _nFirstCol, _nFirstRow, true ),
+ GetCellStyleLeft( _nFirstCol, _nFirstRow ), GetCellStyleTop( _nFirstCol, _nFirstRow ),
+ GetCellStyleRight( _nLastCol, _nLastRow ), GetCellStyleBottom( _nLastCol, _nLastRow ),
+ GetCellStyleLeft( _nFirstCol, _nLastRow ), GetCellStyleBottom( _nFirstCol, _nLastRow ),
+ GetCellStyleRight( _nLastCol, _nFirstRow ), GetCellStyleTop( _nLastCol, _nFirstRow ),
+ pForceColor, mxImpl->mbDiagDblClip );
+ }
+ }
+ }
+ }
+ rDev.Pop(); // clip region
+
+ // *** horizontal frame borders ***
+
+ for( nRow = nFirstRow; nRow <= nLastRow + 1; ++nRow )
+ {
+ double fAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow );
+ double fTAngle = mxImpl->GetHorDiagAngle( nFirstCol, nRow - 1 );
+
+ // *Start*** variables store the data of the left end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nFirstCol ), mxImpl->GetRowPosition( nRow ) );
+ const Style* pStart = &GetCellStyleTop( nFirstCol, nRow );
+ DiagStyle aStartLFromTR( GetCellStyleBL( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pStartLFromT = &GetCellStyleLeft( nFirstCol, nRow - 1 );
+ const Style* pStartLFromL = &GetCellStyleTop( nFirstCol - 1, nRow );
+ const Style* pStartLFromB = &GetCellStyleLeft( nFirstCol, nRow );
+ DiagStyle aStartLFromBR( GetCellStyleTL( nFirstCol, nRow ), fAngle );
+
+ // *End*** variables store the data of the right end of the cached frame border
+ DiagStyle aEndRFromTL( GetCellStyleBR( nFirstCol, nRow - 1 ), fTAngle );
+ const Style* pEndRFromT = &GetCellStyleRight( nFirstCol, nRow - 1 );
+ const Style* pEndRFromR = &GetCellStyleTop( nFirstCol + 1, nRow );
+ const Style* pEndRFromB = &GetCellStyleRight( nFirstCol, nRow );
+ DiagStyle aEndRFromBL( GetCellStyleTR( nFirstCol, nRow ), fAngle );
+
+ for( nCol = nFirstCol + 1; nCol <= nLastCol; ++nCol )
+ {
+ fAngle = mxImpl->GetHorDiagAngle( nCol, nRow );
+ fTAngle = mxImpl->GetHorDiagAngle( nCol, nRow - 1 );
+
+ const Style& rCurr = *pEndRFromR;
+
+ DiagStyle aLFromTR( GetCellStyleBL( nCol, nRow - 1 ), fTAngle );
+ const Style& rLFromT = *pEndRFromT;
+ const Style& rLFromL = *pStart;
+ const Style& rLFromB = *pEndRFromB;
+ DiagStyle aLFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aRFromTL( GetCellStyleBR( nCol, nRow - 1 ), fTAngle );
+ const Style& rRFromT = GetCellStyleRight( nCol, nRow - 1 );
+ const Style& rRFromR = GetCellStyleTop( nCol + 1, nRow );
+ const Style& rRFromB = GetCellStyleRight( nCol, nRow );
+ DiagStyle aRFromBL( GetCellStyleTR( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndRFromTL, rLFromT, aLFromTR, aEndRFromBL, rLFromB, aLFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ DrawHorFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartLFromTR = aLFromTR;
+ pStartLFromT = &rLFromT;
+ pStartLFromL = &rLFromL;
+ pStartLFromB = &rLFromB;
+ aStartLFromBR = aLFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndRFromTL = aRFromTL;
+ pEndRFromT = &rRFromT;
+ pEndRFromR = &rRFromR;
+ pEndRFromB = &rRFromB;
+ aEndRFromBL = aRFromBL;
+ }
+
+ // draw last frame border
+ Point aEndPos( mxImpl->GetColPosition( nCol ), aStartPos.Y() );
+ if( pStart->Prim() && (aStartPos.X() <= aEndPos.X()) )
+ DrawHorFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartLFromTR, *pStartLFromT, *pStartLFromL, *pStartLFromB, aStartLFromBR,
+ aEndRFromTL, *pEndRFromT, *pEndRFromR, *pEndRFromB, aEndRFromBL, pForceColor );
+ }
+
+ // *** vertical frame borders ***
+
+ for( nCol = nFirstCol; nCol <= nLastCol + 1; ++nCol )
+ {
+ double fAngle = mxImpl->GetVerDiagAngle( nCol, nFirstRow );
+ double fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nFirstRow );
+
+ // *Start*** variables store the data of the top end of the cached frame border
+ Point aStartPos( mxImpl->GetColPosition( nCol ), mxImpl->GetRowPosition( nFirstRow ) );
+ const Style* pStart = &GetCellStyleLeft( nCol, nFirstRow );
+ DiagStyle aStartTFromBL( GetCellStyleTR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pStartTFromL = &GetCellStyleTop( nCol - 1, nFirstRow );
+ const Style* pStartTFromT = &GetCellStyleLeft( nCol, nFirstRow - 1 );
+ const Style* pStartTFromR = &GetCellStyleTop( nCol, nFirstRow );
+ DiagStyle aStartTFromBR( GetCellStyleTL( nCol, nFirstRow ), fAngle );
+
+ // *End*** variables store the data of the bottom end of the cached frame border
+ DiagStyle aEndBFromTL( GetCellStyleBR( nCol - 1, nFirstRow ), fLAngle );
+ const Style* pEndBFromL = &GetCellStyleBottom( nCol - 1, nFirstRow );
+ const Style* pEndBFromB = &GetCellStyleLeft( nCol, nFirstRow + 1 );
+ const Style* pEndBFromR = &GetCellStyleBottom( nCol, nFirstRow );
+ DiagStyle aEndBFromTR( GetCellStyleBL( nCol, nFirstRow ), fAngle );
+
+ for( nRow = nFirstRow + 1; nRow <= nLastRow; ++nRow )
+ {
+ fAngle = mxImpl->GetVerDiagAngle( nCol, nRow );
+ fLAngle = mxImpl->GetVerDiagAngle( nCol - 1, nRow );
+
+ const Style& rCurr = *pEndBFromB;
+
+ DiagStyle aTFromBL( GetCellStyleTR( nCol - 1, nRow ), fLAngle );
+ const Style& rTFromL = *pEndBFromL;
+ const Style& rTFromT = *pStart;
+ const Style& rTFromR = *pEndBFromR;
+ DiagStyle aTFromBR( GetCellStyleTL( nCol, nRow ), fAngle );
+
+ DiagStyle aBFromTL( GetCellStyleBR( nCol - 1, nRow ), fLAngle );
+ const Style& rBFromL = GetCellStyleBottom( nCol - 1, nRow );
+ const Style& rBFromB = GetCellStyleLeft( nCol, nRow + 1 );
+ const Style& rBFromR = GetCellStyleBottom( nCol, nRow );
+ DiagStyle aBFromTR( GetCellStyleBL( nCol, nRow ), fAngle );
+
+ // check if current frame border can be connected to cached frame border
+ if( !CheckFrameBorderConnectable( *pStart, rCurr,
+ aEndBFromTL, rTFromL, aTFromBL, aEndBFromTR, rTFromR, aTFromBR ) )
+ {
+ // draw previous frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ DrawVerFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR, pForceColor );
+
+ // re-init "*Start***" variables
+ aStartPos = aEndPos;
+ pStart = &rCurr;
+ aStartTFromBL = aTFromBL;
+ pStartTFromL = &rTFromL;
+ pStartTFromT = &rTFromT;
+ pStartTFromR = &rTFromR;
+ aStartTFromBR = aTFromBR;
+ }
+
+ // store current styles in "*End***" variables
+ aEndBFromTL = aBFromTL;
+ pEndBFromL = &rBFromL;
+ pEndBFromB = &rBFromB;
+ pEndBFromR = &rBFromR;
+ aEndBFromTR = aBFromTR;
+ }
+
+ // draw last frame border
+ Point aEndPos( aStartPos.X(), mxImpl->GetRowPosition( nRow ) );
+ if( pStart->Prim() && (aStartPos.Y() <= aEndPos.Y()) )
+ DrawVerFrameBorder( rDev, aStartPos, aEndPos, *pStart,
+ aStartTFromBL, *pStartTFromL, *pStartTFromT, *pStartTFromR, aStartTFromBR,
+ aEndBFromTL, *pEndBFromL, *pEndBFromB, *pEndBFromR, aEndBFromTR, pForceColor );
+ }
+}
+
+void Array::DrawArray( OutputDevice& rDev, const Color* pForceColor ) const
+{
+ if( mxImpl->mnWidth && mxImpl->mnHeight )
+ DrawRange( rDev, 0, 0, mxImpl->mnWidth - 1, mxImpl->mnHeight - 1, pForceColor );
+}
+
+// ----------------------------------------------------------------------------
+
+#undef ORIGCELLACC
+#undef ORIGCELL
+#undef CELLACC
+#undef CELL
+
+// ----------------------------------------------------------------------------
+
+#undef DBG_FRAME_CHECK_ROW_1
+#undef DBG_FRAME_CHECK_COL_1
+#undef DBG_FRAME_CHECK_INDEX
+#undef DBG_FRAME_CHECK_COLROW
+#undef DBG_FRAME_CHECK_ROW
+#undef DBG_FRAME_CHECK_COL
+#undef DBG_FRAME_CHECK
+#undef DBG_FRAME_ERROR
+
+// ============================================================================
+
+} // namespace frame
+} // namespace svx
+
diff --git a/svx/source/dialog/frmdirlbox.cxx b/svx/source/dialog/frmdirlbox.cxx
new file mode 100644
index 000000000000..dcfc14afcacd
--- /dev/null
+++ b/svx/source/dialog/frmdirlbox.cxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/frmdirlbox.hxx>
+
+namespace svx {
+
+// ============================================================================
+
+namespace {
+
+inline void* lclEnumToVoid( SvxFrameDirection eDirection )
+{
+ return reinterpret_cast< void* >( static_cast< sal_uInt32 >( eDirection ) );
+}
+
+inline SvxFrameDirection lclVoidToEnum( void* pDirection )
+{
+ return static_cast< SvxFrameDirection >( reinterpret_cast< sal_IntPtr >( pDirection ) );
+}
+
+} // namespace
+
+// ============================================================================
+
+FrameDirectionListBox::FrameDirectionListBox( Window* pParent, WinBits nStyle ) :
+ ListBox( pParent, nStyle )
+{
+}
+
+FrameDirectionListBox::FrameDirectionListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( pParent, rResId )
+{
+}
+
+FrameDirectionListBox::~FrameDirectionListBox()
+{
+}
+
+void FrameDirectionListBox::InsertEntryValue( const String& rString, SvxFrameDirection eDirection, sal_uInt16 nPos )
+{
+ sal_uInt16 nRealPos = InsertEntry( rString, nPos );
+ SetEntryData( nRealPos, lclEnumToVoid( eDirection ) );
+}
+
+void FrameDirectionListBox::RemoveEntryValue( SvxFrameDirection eDirection )
+{
+ sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nPos );
+}
+
+void FrameDirectionListBox::SelectEntryValue( SvxFrameDirection eDirection )
+{
+ sal_uInt16 nPos = GetEntryPos( lclEnumToVoid( eDirection ) );
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ SetNoSelection();
+ else
+ SelectEntryPos( nPos );
+}
+
+SvxFrameDirection FrameDirectionListBox::GetSelectEntryValue() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ return static_cast< SvxFrameDirection >( 0xFFFF );
+ return lclVoidToEnum( GetEntryData( nPos ) );
+}
+
+// ============================================================================
+
+FrameDirListBoxWrapper::FrameDirListBoxWrapper( FrameDirListBox& rListBox ) :
+ SingleControlWrapperType( rListBox )
+{
+}
+
+bool FrameDirListBoxWrapper::IsControlDontKnow() const
+{
+ return GetControl().GetSelectEntryCount() == 0;
+}
+
+void FrameDirListBoxWrapper::SetControlDontKnow( bool bSet )
+{
+ if( bSet )
+ GetControl().SetNoSelection();
+}
+
+SvxFrameDirection FrameDirListBoxWrapper::GetControlValue() const
+{
+ return GetControl().GetSelectEntryValue();
+}
+
+void FrameDirListBoxWrapper::SetControlValue( SvxFrameDirection eValue )
+{
+ GetControl().SelectEntryValue( eValue );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
new file mode 100644
index 000000000000..d25473f32570
--- /dev/null
+++ b/svx/source/dialog/frmsel.cxx
@@ -0,0 +1,1205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/frmsel.hxx>
+
+#include <algorithm>
+#include <math.h>
+#include "frmselimpl.hxx"
+#include "AccessibleFrameSelector.hxx"
+#include <svx/dialmgr.hxx>
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef SVX_FRMSEL_HRC
+#include "frmsel.hrc"
+#endif
+
+#include <tools/rcid.h>
+
+namespace svx {
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::accessibility::XAccessible;
+
+// ============================================================================
+// global functions from framebordertype.hxx
+
+FrameBorderType GetFrameBorderTypeFromIndex( size_t nIndex )
+{
+ DBG_ASSERT( nIndex < (size_t)FRAMEBORDERTYPE_COUNT,
+ "svx::GetFrameBorderTypeFromIndex - invalid index" );
+ return static_cast< FrameBorderType >( nIndex + 1 );
+}
+
+size_t GetIndexFromFrameBorderType( FrameBorderType eBorder )
+{
+ DBG_ASSERT( eBorder != FRAMEBORDER_NONE,
+ "svx::GetIndexFromFrameBorderType - invalid frame border type" );
+ return static_cast< size_t >( eBorder ) - 1;
+}
+
+// ============================================================================
+
+namespace {
+
+/** Space between outer control border and any graphical element of the control. */
+const long FRAMESEL_GEOM_OUTER = 2;
+
+/** Space between arrows and usable inner area. */
+const long FRAMESEL_GEOM_INNER = 3;
+
+/** Maximum width to draw a frame border style. */
+const long FRAMESEL_GEOM_WIDTH = 9;
+
+/** Additional margin for click area of outer lines. */
+const long FRAMESEL_GEOM_ADD_CLICK_OUTER = 5;
+
+/** Additional margin for click area of inner lines. */
+const long FRAMESEL_GEOM_ADD_CLICK_INNER = 2;
+
+// ----------------------------------------------------------------------------
+
+static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0 );
+static const FrameBorder OBJ_FRAMEBORDER_NONE( FRAMEBORDER_NONE );
+
+// ----------------------------------------------------------------------------
+
+/** Returns the corresponding flag for a frame border. */
+FrameSelFlags lclGetFlagFromType( FrameBorderType eBorder )
+{
+ switch( eBorder )
+ {
+ case FRAMEBORDER_LEFT: return FRAMESEL_LEFT;
+ case FRAMEBORDER_RIGHT: return FRAMESEL_RIGHT;
+ case FRAMEBORDER_TOP: return FRAMESEL_TOP;
+ case FRAMEBORDER_BOTTOM: return FRAMESEL_BOTTOM;
+ case FRAMEBORDER_HOR: return FRAMESEL_INNER_HOR;
+ case FRAMEBORDER_VER: return FRAMESEL_INNER_VER;
+ case FRAMEBORDER_TLBR: return FRAMESEL_DIAG_TLBR;
+ case FRAMEBORDER_BLTR: return FRAMESEL_DIAG_BLTR;
+ case FRAMEBORDER_NONE : break;
+ }
+ return FRAMESEL_NONE;
+}
+
+/** Converts an SvxBorderLine line width (in twips) to a pixel line width. */
+inline sal_uInt16 lclGetPixel( sal_uInt16 nWidth )
+{
+ // convert all core styles expect 0 to a visible UI style (at least 1 pixel), map 1pt to 1pixel
+ return nWidth ? std::min< sal_uInt16 >( std::max< sal_uInt16 >( (nWidth + 5) / 20, 1 ), FRAMESEL_GEOM_WIDTH ) : 0;
+}
+
+/** Merges the rSource polypolygon into the rDest polypolygon. */
+inline void lclPolyPolyUnion( PolyPolygon& rDest, const PolyPolygon& rSource )
+{
+ const PolyPolygon aTmp( rDest );
+ aTmp.GetUnion( rSource, rDest );
+}
+
+} // namespace
+
+// ============================================================================
+// FrameBorder
+// ============================================================================
+
+FrameBorder::FrameBorder( FrameBorderType eType ) :
+ meType( eType ),
+ meState( FRAMESTATE_HIDE ),
+ meKeyLeft( FRAMEBORDER_NONE ),
+ meKeyRight( FRAMEBORDER_NONE ),
+ meKeyTop( FRAMEBORDER_NONE ),
+ meKeyBottom( FRAMEBORDER_NONE ),
+ mbEnabled( false ),
+ mbSelected( false )
+{
+}
+
+void FrameBorder::Enable( FrameSelFlags nFlags )
+{
+ mbEnabled = (nFlags & lclGetFlagFromType( meType )) != 0;
+ if( !mbEnabled )
+ SetState( FRAMESTATE_HIDE );
+}
+
+void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
+{
+ if( pStyle )
+ maCoreStyle = *pStyle;
+ else
+ maCoreStyle = SvxBorderLine();
+
+ // from twips to points
+ maUIStyle.Set( maCoreStyle, 0.05, FRAMESEL_GEOM_WIDTH, true );
+ meState = maUIStyle.Prim() ? FRAMESTATE_SHOW : FRAMESTATE_HIDE;
+}
+
+void FrameBorder::SetState( FrameBorderState eState )
+{
+ meState = eState;
+ switch( meState )
+ {
+ case FRAMESTATE_SHOW:
+ DBG_ERRORFILE( "svx::FrameBorder::SetState - use SetCoreStyle to make border visible" );
+ break;
+ case FRAMESTATE_HIDE:
+ maCoreStyle = SvxBorderLine();
+ maUIStyle.Clear();
+ break;
+ case FRAMESTATE_DONTCARE:
+ maCoreStyle = SvxBorderLine();
+ maUIStyle = OBJ_FRAMESTYLE_DONTCARE;
+ break;
+ }
+}
+
+void FrameBorder::AddFocusPolygon( const Polygon& rFocus )
+{
+ lclPolyPolyUnion( maFocusArea, rFocus );
+}
+
+void FrameBorder::MergeFocusToPolyPolygon( PolyPolygon& rPPoly ) const
+{
+ lclPolyPolyUnion( rPPoly, maFocusArea );
+}
+
+void FrameBorder::AddClickRect( const Rectangle& rRect )
+{
+ lclPolyPolyUnion( maClickArea, Polygon( rRect ) );
+}
+
+bool FrameBorder::ContainsClickPoint( const Point& rPos ) const
+{
+ return Region( maClickArea ).IsInside( rPos );
+}
+
+void FrameBorder::MergeClickAreaToPolyPolygon( PolyPolygon& rPPoly ) const
+{
+ lclPolyPolyUnion( rPPoly, maClickArea );
+}
+
+Rectangle FrameBorder::GetClickBoundRect() const
+{
+ return maClickArea.GetBoundRect();
+}
+
+void FrameBorder::SetKeyboardNeighbors(
+ FrameBorderType eLeft, FrameBorderType eRight, FrameBorderType eTop, FrameBorderType eBottom )
+{
+ meKeyLeft = eLeft;
+ meKeyRight = eRight;
+ meKeyTop = eTop;
+ meKeyBottom = eBottom;
+}
+
+FrameBorderType FrameBorder::GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const
+{
+ FrameBorderType eBorder = FRAMEBORDER_NONE;
+ switch( nKeyCode )
+ {
+ case KEY_LEFT: eBorder = meKeyLeft; break;
+ case KEY_RIGHT: eBorder = meKeyRight; break;
+ case KEY_UP: eBorder = meKeyTop; break;
+ case KEY_DOWN: eBorder = meKeyBottom; break;
+ default: DBG_ERRORFILE( "svx::FrameBorder::GetKeyboardNeighbor - unknown key code" );
+ }
+ return eBorder;
+}
+
+// ============================================================================
+// FrameSelectorImpl
+// ============================================================================
+
+FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
+ Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
+ mrFrameSel( rFrameSel ),
+ maILArrows( 16 ),
+ maLeft( FRAMEBORDER_LEFT ),
+ maRight( FRAMEBORDER_RIGHT ),
+ maTop( FRAMEBORDER_TOP ),
+ maBottom( FRAMEBORDER_BOTTOM ),
+ maHor( FRAMEBORDER_HOR ),
+ maVer( FRAMEBORDER_VER ),
+ maTLBR( FRAMEBORDER_TLBR ),
+ maBLTR( FRAMEBORDER_BLTR ),
+ mnFlags( FRAMESEL_OUTER ),
+ mbHor( false ),
+ mbVer( false ),
+ mbTLBR( false ),
+ mbBLTR( false ),
+ mbFullRepaint( true ),
+ mbAutoSelect( true ),
+ mbClicked( false ),
+ mbHCMode( false ),
+ mpAccess( 0 ),
+ maChildVec( 8, static_cast< a11y::AccFrameSelector* >( 0 ) ),
+ mxChildVec( 8 )
+{
+ FreeResource();
+
+ maAllBorders.resize( FRAMEBORDERTYPE_COUNT, 0 );
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_LEFT ) ] = &maLeft;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_RIGHT ) ] = &maRight;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_TOP ) ] = &maTop;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_BOTTOM ) ] = &maBottom;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_HOR ) ] = &maHor;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_VER ) ] = &maVer;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_TLBR ) ] = &maTLBR;
+ maAllBorders[ GetIndexFromFrameBorderType( FRAMEBORDER_BLTR ) ] = &maBLTR;
+#if OSL_DEBUG_LEVEL >= 2
+ {
+ bool bOk = true;
+ for( FrameBorderCIter aIt( maAllBorders ); bOk && aIt.Is(); bOk = (*aIt != 0), ++aIt );
+ DBG_ASSERT( bOk, "svx::FrameSelectorImpl::FrameSelectorImpl - missing entry in maAllBorders" );
+ }
+#endif
+ // left neighbor right neighbor upper neighbor lower neighbor
+ maLeft.SetKeyboardNeighbors( FRAMEBORDER_NONE, FRAMEBORDER_TLBR, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maRight.SetKeyboardNeighbors( FRAMEBORDER_BLTR, FRAMEBORDER_NONE, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maTop.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_NONE, FRAMEBORDER_TLBR );
+ maBottom.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_BLTR, FRAMEBORDER_NONE );
+ maHor.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_RIGHT, FRAMEBORDER_TLBR, FRAMEBORDER_BLTR );
+ maVer.SetKeyboardNeighbors( FRAMEBORDER_TLBR, FRAMEBORDER_BLTR, FRAMEBORDER_TOP, FRAMEBORDER_BOTTOM );
+ maTLBR.SetKeyboardNeighbors( FRAMEBORDER_LEFT, FRAMEBORDER_VER, FRAMEBORDER_TOP, FRAMEBORDER_HOR );
+ maBLTR.SetKeyboardNeighbors( FRAMEBORDER_VER, FRAMEBORDER_RIGHT, FRAMEBORDER_HOR, FRAMEBORDER_BOTTOM );
+}
+
+FrameSelectorImpl::~FrameSelectorImpl()
+{
+ if( mpAccess )
+ mpAccess->Invalidate();
+ for( AccessibleImplVec::iterator aIt = maChildVec.begin(), aEnd = maChildVec.end(); aIt != aEnd; ++aIt )
+ if( *aIt )
+ (*aIt)->Invalidate();
+}
+
+// initialization -------------------------------------------------------------
+
+void FrameSelectorImpl::Initialize( FrameSelFlags nFlags )
+{
+ mnFlags = nFlags;
+
+ maEnabBorders.clear();
+ for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
+ {
+ (*aIt)->Enable( mnFlags );
+ if( (*aIt)->IsEnabled() )
+ maEnabBorders.push_back( *aIt );
+ }
+ mbHor = maHor.IsEnabled();
+ mbVer = maVer.IsEnabled();
+ mbTLBR = maTLBR.IsEnabled();
+ mbBLTR = maBLTR.IsEnabled();
+
+ InitVirtualDevice();
+}
+
+void FrameSelectorImpl::InitColors()
+{
+ const StyleSettings& rSett = mrFrameSel.GetSettings().GetStyleSettings();
+ maBackCol = rSett.GetFieldColor();
+ mbHCMode = rSett.GetHighContrastMode();
+ maArrowCol = rSett.GetFieldTextColor();
+ maMarkCol.operator=( maBackCol ).Merge( maArrowCol, mbHCMode ? 0x80 : 0xC0 );
+ maHCLineCol = rSett.GetLabelTextColor();
+}
+
+void FrameSelectorImpl::InitArrowImageList()
+{
+ /* Build the arrow images bitmap with current colors. */
+ Color pColorAry1[3];
+ Color pColorAry2[3];
+ pColorAry1[0] = Color( 0, 0, 0 );
+ pColorAry2[0] = maArrowCol; // black -> arrow color
+ pColorAry1[1] = Color( 0, 255, 0 );
+ pColorAry2[1] = maMarkCol; // green -> marker color
+ pColorAry1[2] = Color( 255, 0, 255 );
+ pColorAry2[2] = maBackCol; // magenta -> background
+
+ GetRes( SVX_RES( RID_SVXSTR_BORDER_CONTROL ).SetRT( RSC_RESOURCE ) );
+ maILArrows.InsertFromHorizontalBitmap(
+ SVX_RES( BMP_FRMSEL_ARROWS ), 16, NULL, pColorAry1, pColorAry2, 3);
+ FreeResource();
+ DBG_ASSERT( maILArrows.GetImageSize().Height() == maILArrows.GetImageSize().Width(),
+ "svx::FrameSelectorImpl::InitArrowImageList - images are not squarish" );
+ mnArrowSize = maILArrows.GetImageSize().Height();
+}
+
+void FrameSelectorImpl::InitGlobalGeometry()
+{
+ Size aCtrlSize( mrFrameSel.CalcOutputSize( mrFrameSel.GetSizePixel() ) );
+ /* nMinSize is the lower of width and height (control will always be squarish).
+ FRAMESEL_GEOM_OUTER is the minimal distance between inner control border
+ and any element. */
+ long nMinSize = Min( aCtrlSize.Width(), aCtrlSize.Height() ) - 2 * FRAMESEL_GEOM_OUTER;
+ /* nFixedSize is the size all existing elements need in one direction:
+ the diag. arrow, space betw. arrow and frame border, outer frame border,
+ inner frame border, other outer frame border, space betw. frame border
+ and arrow, the other arrow. */
+ long nFixedSize = 2 * mnArrowSize + 2 * FRAMESEL_GEOM_INNER + 3 * FRAMESEL_GEOM_WIDTH;
+ /* nBetwBordersSize contains the size between an outer and inner frame border (made odd). */
+ long nBetwBordersSize = (((nMinSize - nFixedSize) / 2) - 1) | 1;
+
+ /* The final size of the usable area. */
+ mnCtrlSize = 2 * nBetwBordersSize + nFixedSize;
+ maVirDev.SetOutputSizePixel( Size( mnCtrlSize, mnCtrlSize ) );
+
+ /* Center the virtual device in the control. */
+ maVirDevPos = Point( (aCtrlSize.Width() - mnCtrlSize) / 2, (aCtrlSize.Height() - mnCtrlSize) / 2 );
+}
+
+void FrameSelectorImpl::InitBorderGeometry()
+{
+ size_t nCol, nCols, nRow, nRows;
+
+ // Global border geometry values ------------------------------------------
+
+ /* mnLine* is the middle point inside a frame border (i.e. mnLine1 is mid X inside left border). */
+ mnLine1 = mnArrowSize + FRAMESEL_GEOM_INNER + FRAMESEL_GEOM_WIDTH / 2;
+ mnLine2 = mnCtrlSize / 2;
+ mnLine3 = 2 * mnLine2 - mnLine1;
+
+ // Frame helper array -----------------------------------------------------
+
+ maArray.Initialize( mbVer ? 2 : 1, mbHor ? 2 : 1 );
+ maArray.SetUseDiagDoubleClipping( true );
+
+ maArray.SetXOffset( mnLine1 );
+ maArray.SetAllColWidths( (mbVer ? mnLine2 : mnLine3) - mnLine1 );
+
+ maArray.SetYOffset( mnLine1 );
+ maArray.SetAllRowHeights( (mbHor ? mnLine2 : mnLine3) - mnLine1 );
+
+ Rectangle aTLRect( maArray.GetCellRect( 0, 0 ) );
+
+ // Focus polygons ---------------------------------------------------------
+
+ /* Width for focus rectangles from center of frame borders. */
+ mnFocusOffs = FRAMESEL_GEOM_WIDTH / 2 + 1;
+
+ maLeft.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine1 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maVer.AddFocusPolygon( Rectangle( mnLine2 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine2 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maRight.AddFocusPolygon( Rectangle( mnLine3 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+ maTop.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine1 + mnFocusOffs ) );
+ maHor.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine2 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine2 + mnFocusOffs ) );
+ maBottom.AddFocusPolygon( Rectangle( mnLine1 - mnFocusOffs, mnLine3 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+
+ for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
+ {
+ for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
+ {
+ Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
+ long nDiagFocusOffsX = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetHorDiagAngle( nCol, nRow ) );
+ long nDiagFocusOffsY = frame::GetTLDiagOffset( -mnFocusOffs, mnFocusOffs, maArray.GetVerDiagAngle( nCol, nRow ) );
+
+ std::vector< Point > aFocusVec;
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Top() + nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() + nDiagFocusOffsX, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Bottom() + mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() - nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ) );
+ maTLBR.AddFocusPolygon( Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) );
+
+ aFocusVec.clear();
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Top() + nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Right() + mnFocusOffs, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Right() - nDiagFocusOffsX, aRect.Top() - mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Bottom() - nDiagFocusOffsY ) );
+ aFocusVec.push_back( Point( aRect.Left() - mnFocusOffs, aRect.Bottom() + mnFocusOffs ) );
+ aFocusVec.push_back( Point( aRect.Left() + nDiagFocusOffsX, aRect.Bottom() + mnFocusOffs ) );
+ maBLTR.AddFocusPolygon( Polygon( static_cast< sal_uInt16 >( aFocusVec.size() ), &aFocusVec[ 0 ] ) );
+ }
+ }
+
+ // Click areas ------------------------------------------------------------
+
+ for( FrameBorderIter aIt( maAllBorders ); aIt.Is(); ++aIt )
+ (*aIt)->ClearClickArea();
+
+ /* Additional space for click area: is added to the space available to draw
+ the frame borders. For instance left frame border:
+ - To left, top, and bottom always big additional space (outer area).
+ - To right: Dependent on existence of inner vertical frame border
+ (if enabled, use less space).
+ */
+ long nClO = FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_OUTER;
+ long nClI = (mbTLBR && mbBLTR) ? (FRAMESEL_GEOM_WIDTH / 2 + FRAMESEL_GEOM_ADD_CLICK_INNER) : nClO;
+ long nClH = mbHor ? nClI : nClO; // additional space dependent of horizontal inner border
+ long nClV = mbVer ? nClI : nClO; // additional space dependent of vertical inner border
+
+ maLeft.AddClickRect( Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine1 + nClV, mnLine3 + nClO ) );
+ maVer.AddClickRect( Rectangle( mnLine2 - nClI, mnLine1 - nClO, mnLine2 + nClI, mnLine3 + nClO ) );
+ maRight.AddClickRect( Rectangle( mnLine3 - nClV, mnLine1 - nClO, mnLine3 + nClO, mnLine3 + nClO ) );
+ maTop.AddClickRect( Rectangle( mnLine1 - nClO, mnLine1 - nClO, mnLine3 + nClO, mnLine1 + nClH ) );
+ maHor.AddClickRect( Rectangle( mnLine1 - nClO, mnLine2 - nClI, mnLine3 + nClO, mnLine2 + nClI ) );
+ maBottom.AddClickRect( Rectangle( mnLine1 - nClO, mnLine3 - nClH, mnLine3 + nClO, mnLine3 + nClO ) );
+
+ /* Diagonal frame borders use the remaining space between outer and inner frame borders. */
+ if( mbTLBR || mbBLTR )
+ {
+ for( nCol = 0, nCols = maArray.GetColCount(); nCol < nCols; ++nCol )
+ {
+ for( nRow = 0, nRows = maArray.GetRowCount(); nRow < nRows; ++nRow )
+ {
+ // the usable area between horizonal/vertical frame borders of current quadrant
+ Rectangle aRect( maArray.GetCellRect( nCol, nRow ) );
+ aRect.Left() += nClV + 1;
+ aRect.Right() -= nClV + 1;
+ aRect.Top() += nClH + 1;
+ aRect.Bottom() -= nClH + 1;
+
+ /* Both diagonal frame borders enabled. */
+ if( mbTLBR && mbBLTR )
+ {
+ // single areas
+ Point aMid( aRect.Center() );
+ maTLBR.AddClickRect( Rectangle( aRect.TopLeft(), aMid ) );
+ maTLBR.AddClickRect( Rectangle( aMid + Point( 1, 1 ), aRect.BottomRight() ) );
+ maBLTR.AddClickRect( Rectangle( aRect.Left(), aMid.Y() + 1, aMid.X(), aRect.Bottom() ) );
+ maBLTR.AddClickRect( Rectangle( aMid.X() + 1, aRect.Top(), aRect.Right(), aMid.Y() ) );
+ // centered rectangle for both frame borders
+ Rectangle aMidRect( aRect.TopLeft(), Size( aRect.GetWidth() / 3, aRect.GetHeight() / 3 ) );
+ aMidRect.Move( (aRect.GetWidth() - aMidRect.GetWidth()) / 2, (aRect.GetHeight() - aMidRect.GetHeight()) / 2 );
+ maTLBR.AddClickRect( aMidRect );
+ maBLTR.AddClickRect( aMidRect );
+ }
+ /* One of the diagonal frame borders enabled - use entire rectangle. */
+ else if( mbTLBR && !mbBLTR ) // top-left to bottom-right only
+ maTLBR.AddClickRect( aRect );
+ else if( !mbTLBR && mbBLTR ) // bottom-left to top-right only
+ maBLTR.AddClickRect( aRect );
+ }
+ }
+ }
+}
+
+void FrameSelectorImpl::InitVirtualDevice()
+{
+ // initialize resources
+ InitColors();
+ InitArrowImageList();
+
+ // initialize geometry
+ InitGlobalGeometry();
+ InitBorderGeometry();
+
+ // correct background around the used area
+ mrFrameSel.SetBackground( Wallpaper( maBackCol ) );
+ DoInvalidate( true );
+}
+
+// frame border access --------------------------------------------------------
+
+const FrameBorder& FrameSelectorImpl::GetBorder( FrameBorderType eBorder ) const
+{
+ size_t nIndex = GetIndexFromFrameBorderType( eBorder );
+ if( nIndex < maAllBorders.size() )
+ return *maAllBorders[ nIndex ];
+ DBG_ERRORFILE( "svx::FrameSelectorImpl::GetBorder - unknown border type" );
+ return maTop;
+}
+
+FrameBorder& FrameSelectorImpl::GetBorderAccess( FrameBorderType eBorder )
+{
+ return const_cast< FrameBorder& >( GetBorder( eBorder ) );
+}
+
+// drawing --------------------------------------------------------------------
+
+void FrameSelectorImpl::DrawBackground()
+{
+ // clear the area
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( maBackCol );
+ maVirDev.DrawRect( Rectangle( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+
+ // draw the inner gray (or whatever color) rectangle
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( maMarkCol );
+ maVirDev.DrawRect( Rectangle(
+ mnLine1 - mnFocusOffs, mnLine1 - mnFocusOffs, mnLine3 + mnFocusOffs, mnLine3 + mnFocusOffs ) );
+
+ // draw the white space for enabled frame borders
+ PolyPolygon aPPoly;
+ for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ (*aIt)->MergeFocusToPolyPolygon( aPPoly );
+ aPPoly.Optimize( POLY_OPTIMIZE_CLOSE );
+ maVirDev.SetLineColor( maBackCol );
+ maVirDev.SetFillColor( maBackCol );
+ maVirDev.DrawPolyPolygon( aPPoly );
+}
+
+void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::DrawArrows - access to disabled border" );
+
+ long nLinePos = 0;
+ switch( rBorder.GetType() )
+ {
+ case FRAMEBORDER_LEFT:
+ case FRAMEBORDER_TOP: nLinePos = mnLine1; break;
+ case FRAMEBORDER_VER:
+ case FRAMEBORDER_HOR: nLinePos = mnLine2; break;
+ case FRAMEBORDER_RIGHT:
+ case FRAMEBORDER_BOTTOM: nLinePos = mnLine3; break;
+ default: ; //prevent warning
+ }
+ nLinePos -= mnArrowSize / 2;
+
+ long nTLPos = 0;
+ long nBRPos = mnCtrlSize - mnArrowSize;
+ Point aPos1, aPos2;
+ sal_uInt16 nImgId1 = 0, nImgId2 = 0;
+ switch( rBorder.GetType() )
+ {
+ case FRAMEBORDER_LEFT:
+ case FRAMEBORDER_RIGHT:
+ case FRAMEBORDER_VER:
+ aPos1 = Point( nLinePos, nTLPos ); nImgId1 = 1;
+ aPos2 = Point( nLinePos, nBRPos ); nImgId2 = 2;
+ break;
+
+ case FRAMEBORDER_TOP:
+ case FRAMEBORDER_BOTTOM:
+ case FRAMEBORDER_HOR:
+ aPos1 = Point( nTLPos, nLinePos ); nImgId1 = 3;
+ aPos2 = Point( nBRPos, nLinePos ); nImgId2 = 4;
+ break;
+
+ case FRAMEBORDER_TLBR:
+ aPos1 = Point( nTLPos, nTLPos ); nImgId1 = 5;
+ aPos2 = Point( nBRPos, nBRPos ); nImgId2 = 6;
+ break;
+ case FRAMEBORDER_BLTR:
+ aPos1 = Point( nTLPos, nBRPos ); nImgId1 = 7;
+ aPos2 = Point( nBRPos, nTLPos ); nImgId2 = 8;
+ break;
+ default: ; //prevent warning
+ }
+
+ // Arrow or marker? Do not draw arrows into disabled control.
+ sal_uInt16 nSelectAdd = (mrFrameSel.IsEnabled() && rBorder.IsSelected()) ? 0 : 8;
+ maVirDev.DrawImage( aPos1, maILArrows.GetImage( nImgId1 + nSelectAdd ) );
+ maVirDev.DrawImage( aPos2, maILArrows.GetImage( nImgId2 + nSelectAdd ) );
+}
+
+void FrameSelectorImpl::DrawAllArrows()
+{
+ for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ DrawArrows( **aIt );
+}
+
+Color FrameSelectorImpl::GetDrawLineColor( const Color& rColor ) const
+{
+ Color aColor( mbHCMode ? maHCLineCol : rColor );
+ if( aColor == maBackCol )
+ aColor.Invert();
+ return aColor;
+}
+
+void FrameSelectorImpl::DrawAllFrameBorders()
+{
+ // Translate core colors to current UI colors (regards current background and HC mode).
+ for( FrameBorderIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ {
+ Color aCoreColor = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColor();
+ (*aIt)->SetUIColor( GetDrawLineColor( aCoreColor ) );
+ }
+
+ // Copy all frame border styles to the helper array
+ maArray.SetColumnStyleLeft( 0, maLeft.GetUIStyle() );
+ if( mbVer ) maArray.SetColumnStyleLeft( 1, maVer.GetUIStyle() );
+ maArray.SetColumnStyleRight( mbVer ? 1 : 0, maRight.GetUIStyle() );
+
+ maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
+ if( mbHor ) maArray.SetRowStyleTop( 1, maHor.GetUIStyle() );
+ maArray.SetRowStyleBottom( mbHor ? 1 : 0, maBottom.GetUIStyle() );
+
+ for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
+ for( size_t nRow = 0; nRow < maArray.GetRowCount(); ++nRow )
+ maArray.SetCellStyleDiag( nCol, nRow, maTLBR.GetUIStyle(), maBLTR.GetUIStyle() );
+
+ // Let the helper array draw itself
+ maArray.DrawArray( maVirDev );
+}
+
+void FrameSelectorImpl::DrawVirtualDevice()
+{
+ DrawBackground();
+ DrawAllArrows();
+ DrawAllFrameBorders();
+ mbFullRepaint = false;
+}
+
+void FrameSelectorImpl::CopyVirDevToControl()
+{
+ if( mbFullRepaint )
+ DrawVirtualDevice();
+ mrFrameSel.DrawBitmap( maVirDevPos, maVirDev.GetBitmap( Point( 0, 0 ), maVirDev.GetOutputSizePixel() ) );
+}
+
+void FrameSelectorImpl::DrawAllTrackingRects()
+{
+ PolyPolygon aPPoly;
+ if( mrFrameSel.IsAnyBorderSelected() )
+ {
+ for( SelFrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
+ (*aIt)->MergeFocusToPolyPolygon( aPPoly );
+ aPPoly.Move( maVirDevPos.X(), maVirDevPos.Y() );
+ }
+ else
+ // no frame border selected -> draw tracking rectangle around entire control
+ aPPoly.Insert( Polygon( Rectangle( maVirDevPos, maVirDev.GetOutputSizePixel() ) ) );
+
+ aPPoly.Optimize( POLY_OPTIMIZE_CLOSE );
+ for( sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx )
+ mrFrameSel.InvertTracking( aPPoly.GetObject( nIdx ), SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
+}
+
+Point FrameSelectorImpl::GetDevPosFromMousePos( const Point& rMousePos ) const
+{
+ return rMousePos - maVirDevPos;
+}
+
+void FrameSelectorImpl::DoInvalidate( bool bFullRepaint )
+{
+ mbFullRepaint |= bFullRepaint;
+ mrFrameSel.Invalidate( INVALIDATE_NOERASE );
+}
+
+// frame border state and style -----------------------------------------------
+
+void FrameSelectorImpl::SetBorderState( FrameBorder& rBorder, FrameBorderState eState )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" );
+ if( eState == FRAMESTATE_SHOW )
+ SetBorderCoreStyle( rBorder, &maCurrStyle );
+ else
+ rBorder.SetState( eState );
+ DoInvalidate( true );
+}
+
+void FrameSelectorImpl::SetBorderCoreStyle( FrameBorder& rBorder, const SvxBorderLine* pStyle )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderCoreStyle - access to disabled border" );
+ rBorder.SetCoreStyle( pStyle );
+ DoInvalidate( true );
+}
+
+void FrameSelectorImpl::ToggleBorderState( FrameBorder& rBorder )
+{
+ bool bDontCare = mrFrameSel.SupportsDontCareState();
+ switch( rBorder.GetState() )
+ {
+ // same order as tristate check box: visible -> don't care -> hidden
+ case FRAMESTATE_SHOW:
+ SetBorderState( rBorder, bDontCare ? FRAMESTATE_DONTCARE : FRAMESTATE_HIDE );
+ break;
+ case FRAMESTATE_HIDE:
+ SetBorderState( rBorder, FRAMESTATE_SHOW );
+ break;
+ case FRAMESTATE_DONTCARE:
+ SetBorderState( rBorder, FRAMESTATE_HIDE );
+ break;
+ }
+}
+
+// frame border selection -----------------------------------------------------
+
+void FrameSelectorImpl::SelectBorder( FrameBorder& rBorder, bool bSelect )
+{
+ DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SelectBorder - access to disabled border" );
+ rBorder.Select( bSelect );
+ DrawArrows( rBorder );
+ DoInvalidate( false );
+ maSelectHdl.Call( this );
+}
+
+void FrameSelectorImpl::SilentGrabFocus()
+{
+ bool bOldAuto = mbAutoSelect;
+ mbAutoSelect = false;
+ mrFrameSel.GrabFocus();
+ mbAutoSelect = bOldAuto;
+}
+
+bool FrameSelectorImpl::SelectedBordersEqual() const
+{
+ bool bEqual = true;
+ SelFrameBorderCIter aIt( maEnabBorders );
+ if( aIt.Is() )
+ {
+ const SvxBorderLine& rFirstStyle = (*aIt)->GetCoreStyle();
+ for( ++aIt; bEqual && aIt.Is(); ++aIt )
+ bEqual = ((*aIt)->GetCoreStyle() == rFirstStyle);
+ }
+ return bEqual;
+}
+
+// ============================================================================
+// FrameSelector
+// ============================================================================
+
+FrameSelector::FrameSelector( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+ // not in c'tor init list (avoid warning about usage of *this)
+ mxImpl.reset( new FrameSelectorImpl( *this ) );
+ EnableRTL( false ); // #107808# don't mirror the mouse handling
+}
+
+FrameSelector::~FrameSelector()
+{
+}
+
+void FrameSelector::Initialize( FrameSelFlags nFlags )
+{
+ mxImpl->Initialize( nFlags );
+ Show();
+}
+
+// enabled frame borders ------------------------------------------------------
+
+bool FrameSelector::IsBorderEnabled( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).IsEnabled();
+}
+
+sal_Int32 FrameSelector::GetEnabledBorderCount() const
+{
+ return static_cast< sal_Int32 >( mxImpl->maEnabBorders.size() );
+}
+
+FrameBorderType FrameSelector::GetEnabledBorderType( sal_Int32 nIndex ) const
+{
+ FrameBorderType eBorder = FRAMEBORDER_NONE;
+ if( nIndex >= 0 )
+ {
+ size_t nVecIdx = static_cast< size_t >( nIndex );
+ if( nVecIdx < mxImpl->maEnabBorders.size() )
+ eBorder = mxImpl->maEnabBorders[ nVecIdx ]->GetType();
+ }
+ return eBorder;
+}
+
+sal_Int32 FrameSelector::GetEnabledBorderIndex( FrameBorderType eBorder ) const
+{
+ sal_Int32 nIndex = 0;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt, ++nIndex )
+ if( (*aIt)->GetType() == eBorder )
+ return nIndex;
+ return -1;
+}
+
+// frame border state and style -----------------------------------------------
+
+bool FrameSelector::SupportsDontCareState() const
+{
+ return (mxImpl->mnFlags & FRAMESEL_DONTCARE) != 0;
+}
+
+FrameBorderState FrameSelector::GetFrameBorderState( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).GetState();
+}
+
+const SvxBorderLine* FrameSelector::GetFrameBorderStyle( FrameBorderType eBorder ) const
+{
+ const SvxBorderLine& rStyle = mxImpl->GetBorder( eBorder ).GetCoreStyle();
+ // rest of the world uses null pointer for invisible frame border
+ return rStyle.GetOutWidth() ? &rStyle : 0;
+}
+
+void FrameSelector::ShowBorder( FrameBorderType eBorder, const SvxBorderLine* pStyle )
+{
+ mxImpl->SetBorderCoreStyle( mxImpl->GetBorderAccess( eBorder ), pStyle );
+}
+
+void FrameSelector::SetBorderDontCare( FrameBorderType eBorder )
+{
+ mxImpl->SetBorderState( mxImpl->GetBorderAccess( eBorder ), FRAMESTATE_DONTCARE );
+}
+
+bool FrameSelector::IsAnyBorderVisible() const
+{
+ bool bIsSet = false;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !bIsSet && aIt.Is(); ++aIt )
+ bIsSet = ((*aIt)->GetState() == FRAMESTATE_SHOW);
+ return bIsSet;
+}
+
+void FrameSelector::HideAllBorders()
+{
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
+}
+
+bool FrameSelector::GetVisibleWidth( sal_uInt16& rnPrim, sal_uInt16& rnDist, sal_uInt16& rnSecn ) const
+{
+ VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ if( !aIt.Is() )
+ return false;
+
+ const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
+ bool bFound = true;
+ for( ++aIt; bFound && aIt.Is(); ++aIt )
+ bFound =
+ (rStyle.GetOutWidth() == (*aIt)->GetCoreStyle().GetOutWidth()) &&
+ (rStyle.GetDistance() == (*aIt)->GetCoreStyle().GetDistance()) &&
+ (rStyle.GetInWidth() == (*aIt)->GetCoreStyle().GetInWidth());
+
+ if( bFound )
+ {
+ rnPrim = rStyle.GetOutWidth();
+ rnDist = rStyle.GetDistance();
+ rnSecn = rStyle.GetInWidth();
+ }
+ return bFound;
+}
+
+bool FrameSelector::GetVisibleColor( Color& rColor ) const
+{
+ VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ if( !aIt.Is() )
+ return false;
+
+ const SvxBorderLine& rStyle = (*aIt)->GetCoreStyle();
+ bool bFound = true;
+ for( ++aIt; bFound && aIt.Is(); ++aIt )
+ bFound = (rStyle.GetColor() == (*aIt)->GetCoreStyle().GetColor());
+
+ if( bFound )
+ rColor = rStyle.GetColor();
+ return bFound;
+}
+
+// frame border selection -----------------------------------------------------
+
+const Link& FrameSelector::GetSelectHdl() const
+{
+ return mxImpl->maSelectHdl;
+}
+
+void FrameSelector::SetSelectHdl( const Link& rHdl )
+{
+ mxImpl->maSelectHdl = rHdl;
+}
+
+bool FrameSelector::IsBorderSelected( FrameBorderType eBorder ) const
+{
+ return mxImpl->GetBorder( eBorder ).IsSelected();
+}
+
+void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect )
+{
+ mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), bSelect );
+}
+
+bool FrameSelector::IsAnyBorderSelected() const
+{
+ // Construct an iterator for selected borders. If it is valid, there is a selected border.
+ return SelFrameBorderCIter( mxImpl->maEnabBorders ).Is();
+}
+
+void FrameSelector::SelectAllBorders( bool bSelect )
+{
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, bSelect );
+}
+
+void FrameSelector::SelectAllVisibleBorders( bool bSelect )
+{
+ for( VisFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, bSelect );
+}
+
+void FrameSelector::SetStyleToSelection( sal_uInt16 nPrim, sal_uInt16 nDist, sal_uInt16 nSecn )
+{
+ mxImpl->maCurrStyle.SetOutWidth( nPrim );
+ mxImpl->maCurrStyle.SetDistance( nDist );
+ mxImpl->maCurrStyle.SetInWidth( nSecn );
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+}
+
+void FrameSelector::SetColorToSelection( const Color& rColor )
+{
+ mxImpl->maCurrStyle.SetColor( rColor );
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+}
+
+// accessibility --------------------------------------------------------------
+
+Reference< XAccessible > FrameSelector::CreateAccessible()
+{
+ if( !mxImpl->mxAccess.is() )
+ mxImpl->mxAccess = mxImpl->mpAccess =
+ new a11y::AccFrameSelector( *this, FRAMEBORDER_NONE );
+ return mxImpl->mxAccess;
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( FrameBorderType eBorder )
+{
+ Reference< XAccessible > xRet;
+ size_t nVecIdx = static_cast< size_t >( eBorder );
+ if( IsBorderEnabled( eBorder ) && (1 <= nVecIdx) && (nVecIdx <= mxImpl->maChildVec.size()) )
+ {
+ --nVecIdx;
+ if( !mxImpl->maChildVec[ nVecIdx ] )
+ mxImpl->mxChildVec[ nVecIdx ] = mxImpl->maChildVec[ nVecIdx ] =
+ new a11y::AccFrameSelector( *this, eBorder );
+ xRet = mxImpl->mxChildVec[ nVecIdx ];
+ }
+ return xRet;
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( sal_Int32 nIndex )
+{
+ return GetChildAccessible( GetEnabledBorderType( nIndex ) );
+}
+
+Reference< XAccessible > FrameSelector::GetChildAccessible( const Point& rPos )
+{
+ Reference< XAccessible > xRet;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !xRet.is() && aIt.Is(); ++aIt )
+ if( (*aIt)->ContainsClickPoint( rPos ) )
+ xRet = GetChildAccessible( (*aIt)->GetType() );
+ return xRet;
+}
+
+bool FrameSelector::ContainsClickPoint( const Point& rPos ) const
+{
+ bool bContains = false;
+ for( FrameBorderCIter aIt( mxImpl->maEnabBorders ); !bContains && aIt.Is(); ++aIt )
+ bContains = (*aIt)->ContainsClickPoint( rPos );
+ return bContains;
+}
+
+Rectangle FrameSelector::GetClickBoundRect( FrameBorderType eBorder ) const
+{
+ Rectangle aRect;
+ const FrameBorder& rBorder = mxImpl->GetBorder( eBorder );
+ if( rBorder.IsEnabled() )
+ aRect = rBorder.GetClickBoundRect();
+ return aRect;
+}
+
+// virtual functions from base class ------------------------------------------
+
+void FrameSelector::Paint( const Rectangle& )
+{
+ mxImpl->CopyVirDevToControl();
+ if( HasFocus() )
+ mxImpl->DrawAllTrackingRects();
+}
+
+void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ /* Mouse handling:
+ * Click on an unselected frame border:
+ Set current style/color, make frame border visible, deselect all
+ other frame borders.
+ * Click on a selected frame border:
+ Toggle state of the frame border (visible -> don't care -> hidden),
+ deselect all other frame borders.
+ * SHIFT+Click or CTRL+Click on an unselected frame border:
+ Extend selection, set current style/color to all selected frame
+ borders independent of the state/style/color of the borders.
+ * SHIFT+Click or CTRL+Click on a selected frame border:
+ If all frame borders have same style/color, toggle state of all
+ borders (see above), otherwise set current style/color to all
+ borders.
+ * Click on unused area: Do not modify selection and selected frame
+ borders.
+ */
+
+ // #107394# do not auto-select a frame border
+ mxImpl->SilentGrabFocus();
+
+ if( rMEvt.IsLeft() )
+ {
+ Point aPos( mxImpl->GetDevPosFromMousePos( rMEvt.GetPosPixel() ) );
+ FrameBorderPtrVec aDeselectBorders;
+
+ bool bAnyClicked = false; // Any frame border clicked?
+ bool bNewSelected = false; // Any unselected frame border selected?
+
+ /* If frame borders are set to "don't care" and the control does not
+ support this state, hide them on first mouse click.
+ DR 2004-01-30: Why are the borders set to "don't care" then?!? */
+ bool bHideDontCare = !mxImpl->mbClicked && !SupportsDontCareState();
+
+ for( FrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ {
+ if( (*aIt)->ContainsClickPoint( aPos ) )
+ {
+ // frame border is clicked
+ bAnyClicked = true;
+ if( !(*aIt)->IsSelected() )
+ {
+ bNewSelected = true;
+ mxImpl->SelectBorder( **aIt, true );
+ }
+ }
+ else
+ {
+ // hide a "don't care" frame border only if it is not clicked
+ if( bHideDontCare && ((*aIt)->GetState() == FRAMESTATE_DONTCARE) )
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
+
+ // deselect frame borders not clicked (if SHIFT or CTRL are not pressed)
+ if( !rMEvt.IsShift() && !rMEvt.IsMod1() )
+ aDeselectBorders.push_back( *aIt );
+ }
+ }
+
+ if( bAnyClicked )
+ {
+ // any valid frame border clicked? -> deselect other frame borders
+ for( FrameBorderIter aIt( aDeselectBorders ); aIt.Is(); ++aIt )
+ mxImpl->SelectBorder( **aIt, false );
+
+ if( bNewSelected || !mxImpl->SelectedBordersEqual() )
+ {
+ // new frame border selected, selection extended, or selected borders different? -> show
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ // SetBorderState() sets current style and color to the frame border
+ mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+ }
+ else
+ {
+ // all selected frame borders are equal -> toggle state
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->ToggleBorderState( **aIt );
+ }
+ }
+ }
+}
+
+void FrameSelector::KeyInput( const KeyEvent& rKEvt )
+{
+ bool bHandled = false;
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+ if( !aKeyCode.GetModifier() )
+ {
+ sal_uInt16 nCode = aKeyCode.GetCode();
+ switch( nCode )
+ {
+ case KEY_SPACE:
+ {
+ for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+ mxImpl->ToggleBorderState( **aIt );
+ bHandled = true;
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ if( !mxImpl->maEnabBorders.empty() )
+ {
+ // start from first selected frame border
+ SelFrameBorderCIter aIt( mxImpl->maEnabBorders );
+ FrameBorderType eBorder = aIt.Is() ? (*aIt)->GetType() : mxImpl->maEnabBorders.front()->GetType();
+
+ // search for next enabled frame border
+ do
+ {
+ eBorder = mxImpl->GetBorder( eBorder ).GetKeyboardNeighbor( nCode );
+ }
+ while( (eBorder != FRAMEBORDER_NONE) && !IsBorderEnabled( eBorder ) );
+
+ // select the frame border
+ if( eBorder != FRAMEBORDER_NONE )
+ {
+ DeselectAllBorders();
+ SelectBorder( eBorder );
+ }
+ }
+ }
+ break;
+ }
+ }
+ if( !bHandled )
+ Window::KeyInput(rKEvt);
+}
+
+void FrameSelector::GetFocus()
+{
+ // auto-selection of a frame border, if focus reaches control, and nothing is selected
+ if( mxImpl->mbAutoSelect && !IsAnyBorderSelected() && !mxImpl->maEnabBorders.empty() )
+ mxImpl->SelectBorder( *mxImpl->maEnabBorders.front(), true );
+
+ mxImpl->DoInvalidate( false );
+ if( mxImpl->mxAccess.is() )
+ mxImpl->mpAccess->NotifyFocusListeners( sal_True );
+ Control::GetFocus();
+}
+
+void FrameSelector::LoseFocus()
+{
+ mxImpl->DoInvalidate( false );
+ if( mxImpl->mxAccess.is() )
+ mxImpl->mpAccess->NotifyFocusListeners( sal_False );
+ Control::LoseFocus();
+}
+
+void FrameSelector::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ mxImpl->InitVirtualDevice();
+}
+
+// ============================================================================
+
+template< typename Cont, typename Iter, typename Pred >
+FrameBorderIterBase< Cont, Iter, Pred >::FrameBorderIterBase( container_type& rCont ) :
+ maIt( rCont.begin() ),
+ maEnd( rCont.end() )
+{
+ while( Is() && !maPred( *maIt ) ) ++maIt;
+}
+
+template< typename Cont, typename Iter, typename Pred >
+FrameBorderIterBase< Cont, Iter, Pred >& FrameBorderIterBase< Cont, Iter, Pred >::operator++()
+{
+ do { ++maIt; } while( Is() && !maPred( *maIt ) );
+ return *this;
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/frmsel.src b/svx/source/dialog/frmsel.src
new file mode 100644
index 000000000000..754e0b962b29
--- /dev/null
+++ b/svx/source/dialog/frmsel.src
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#ifndef SVX_FRMSEL_HRC
+#include "frmsel.hrc"
+#endif
+
+Resource RID_SVXSTR_BORDER_CONTROL
+{
+ StringArray ARR_TEXTS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Border setting" ; 0; > ;
+ < "Left border line" ; 1; > ;
+ < "Right border line" ; 2; > ;
+ < "Top border line" ; 3; > ;
+ < "Bottom border line" ; 4; > ;
+ < "Horizontal border line" ; 5; > ;
+ < "Vertical border line" ; 6; > ;
+ < "Diagonal border line from top left to bottom right" ; 7; > ;
+ < "Diagonal border line from bottom left to top right" ; 8; > ;
+ };
+ };
+ StringArray ARR_DESCRIPTIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Border setting" ; 0; > ;
+ < "Left border line" ; 1; > ;
+ < "Right border line" ; 2; > ;
+ < "Top border line" ; 3; > ;
+ < "Bottom border line" ; 4; > ;
+ < "Horizontal border line" ; 5; > ;
+ < "Vertical border line" ; 6; > ;
+ < "Diagonal border line from top left to bottom right" ; 7; > ;
+ < "Diagonal border line from bottom left to top right" ; 8; > ;
+ };
+ };
+
+ Bitmap BMP_FRMSEL_ARROWS { File = "frmsel.bmp"; };
+};
+
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
new file mode 100644
index 000000000000..66f4e34eb022
--- /dev/null
+++ b/svx/source/dialog/graphctl.cxx
@@ -0,0 +1,960 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svl/itempool.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/wrkwin.hxx>
+#include <unotools/syslocale.hxx>
+#include <rtl/math.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+
+#include <svx/graphctl.hxx>
+#include "GraphCtlAccessibleContext.hxx"
+#include "svx/xoutbmp.hxx"
+#include <svx/svxids.hrc>
+#include <svx/svdpage.hxx>
+
+// #i72889#
+#include "svx/sdrpaintwindow.hxx"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, const Rectangle& /*rOldBoundRect*/ )
+{
+ switch( eType )
+ {
+ case( SDRUSERCALL_MOVEONLY ):
+ case( SDRUSERCALL_RESIZE ):
+ rWin.SdrObjChanged( rObj );
+ break;
+
+ case( SDRUSERCALL_INSERTED ):
+ rWin.SdrObjCreated( rObj );
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::GraphCtrl( Window* pParent, const WinBits nWinBits ) :
+ Control ( pParent, nWinBits ),
+ aMap100 ( MAP_100TH_MM ),
+ eObjKind ( OBJ_NONE ),
+ nPolyEdit ( 0 ),
+ bEditMode ( sal_False ),
+ bSdrMode ( sal_False ),
+ mpAccContext ( NULL ),
+ pModel ( NULL ),
+ pView ( NULL )
+{
+ pUserCall = new GraphCtrlUserCall( *this );
+ aUpdateTimer.SetTimeout( 200 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, GraphCtrl, UpdateHdl ) );
+ aUpdateTimer.Start();
+
+ SetWinStyle( nWinBits );
+
+ EnableRTL( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::GraphCtrl( Window* pParent, const ResId& rResId ) :
+ Control ( pParent, rResId ),
+ aMap100 ( MAP_100TH_MM ),
+ nWinStyle ( 0 ),
+ eObjKind ( OBJ_NONE ),
+ nPolyEdit ( 0 ),
+ bEditMode ( sal_False ),
+ bSdrMode ( sal_False ),
+ bAnim ( sal_False ),
+ mpAccContext ( NULL ),
+ pModel ( NULL ),
+ pView ( NULL )
+{
+ pUserCall = new GraphCtrlUserCall( *this );
+ aUpdateTimer.SetTimeout( 500 );
+ aUpdateTimer.SetTimeoutHdl( LINK( this, GraphCtrl, UpdateHdl ) );
+ aUpdateTimer.Start();
+ EnableRTL( sal_False );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphCtrl::~GraphCtrl()
+{
+ if( mpAccContext )
+ {
+ mpAccContext->disposing();
+ mpAccContext->release();
+ }
+ delete pView;
+ delete pModel;
+ delete pUserCall;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetWinStyle( WinBits nWinBits )
+{
+ nWinStyle = nWinBits;
+ bAnim = ( nWinStyle & WB_ANIMATION ) == WB_ANIMATION;
+ bSdrMode = ( nWinStyle & WB_SDRMODE ) == WB_SDRMODE;
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
+ SetMapMode( aMap100 );
+
+ delete pView;
+ pView = NULL;
+
+ delete pModel;
+ pModel = NULL;
+
+ if ( bSdrMode )
+ InitSdrModel();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::InitSdrModel()
+{
+ ::vos::OGuard aGuard (Application::GetSolarMutex());
+
+ SdrPage* pPage;
+
+ // alten Kram zerstoeren
+ delete pView;
+ delete pModel;
+
+ // Model anlegen
+ pModel = new SdrModel;
+ pModel->GetItemPool().FreezeIdRanges();
+ pModel->SetScaleUnit( aMap100.GetMapUnit() );
+ pModel->SetScaleFraction( Fraction( 1, 1 ) );
+ pModel->SetDefaultFontHeight( 500 );
+
+ pPage = new SdrPage( *pModel );
+
+ pPage->SetSize( aGraphSize );
+ pPage->SetBorder( 0, 0, 0, 0 );
+ pModel->InsertPage( pPage );
+ pModel->SetChanged( sal_False );
+
+ // View anlegen
+ pView = new GraphCtrlView( pModel, this );
+ pView->SetWorkArea( Rectangle( Point(), aGraphSize ) );
+ pView->EnableExtendedMouseEventDispatcher( sal_True );
+ pView->ShowSdrPage(pView->GetModel()->GetPage(0));
+// pView->ShowSdrPage(pView->GetModel()->GetPage(0));
+ pView->SetFrameDragSingles( sal_True );
+ pView->SetMarkedPointsSmooth( SDRPATHSMOOTH_SYMMETRIC );
+ pView->SetEditMode( sal_True );
+
+ // #i72889# set neeeded flags
+ pView->SetPagePaintingAllowed(false);
+ pView->SetBufferedOutputAllowed(true);
+ pView->SetBufferedOverlayAllowed(true);
+
+ // Tell the accessibility object about the changes.
+ if (mpAccContext != NULL)
+ mpAccContext->setModelAndView (pModel, pView);
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetGraphic( const Graphic& rGraphic, sal_Bool bNewModel )
+{
+ // Bitmaps dithern wir ggf. fuer die Anzeige
+ if ( !bAnim && ( rGraphic.GetType() == GRAPHIC_BITMAP ) )
+ {
+ if ( rGraphic.IsTransparent() )
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+
+ DitherBitmap( aBmp );
+ aGraphic = Graphic( BitmapEx( aBmp, rGraphic.GetBitmapEx().GetMask() ) );
+ }
+ else
+ {
+ Bitmap aBmp( rGraphic.GetBitmap() );
+ DitherBitmap( aBmp );
+ aGraphic = aBmp;
+ }
+ }
+ else
+ aGraphic = rGraphic;
+
+ if ( aGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
+ aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 );
+ else
+ aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
+
+ if ( bSdrMode && bNewModel )
+ InitSdrModel();
+
+ if ( aGraphSizeLink.IsSet() )
+ aGraphSizeLink.Call( this );
+
+ Resize();
+ Invalidate();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::Resize()
+{
+ Control::Resize();
+
+ if ( aGraphSize.Width() && aGraphSize.Height() )
+ {
+ MapMode aDisplayMap( aMap100 );
+ Point aNewPos;
+ Size aNewSize;
+ const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
+ const long nWidth = aWinSize.Width();
+ const long nHeight = aWinSize.Height();
+ double fGrfWH = (double) aGraphSize.Width() / aGraphSize.Height();
+ double fWinWH = (double) nWidth / nHeight;
+
+ // Bitmap an Thumbgroesse anpassen
+ if ( fGrfWH < fWinWH)
+ {
+ aNewSize.Width() = (long) ( (double) nHeight * fGrfWH );
+ aNewSize.Height()= nHeight;
+ }
+ else
+ {
+ aNewSize.Width() = nWidth;
+ aNewSize.Height()= (long) ( (double) nWidth / fGrfWH );
+ }
+
+ aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
+ aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
+
+ // MapMode fuer Engine umsetzen
+ aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) );
+ aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) );
+
+ aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMap100, aDisplayMap ) );
+ SetMapMode( aDisplayMap );
+ }
+
+ Invalidate();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::Paint( const Rectangle& rRect )
+{
+ // #i72889# used splitted repaint to be able to paint an own background
+ // even to the buffered view
+ const bool bGraphicValid(GRAPHIC_NONE != aGraphic.GetType());
+
+ if(bSdrMode)
+ {
+ SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(this);
+
+ if(bGraphicValid)
+ {
+ OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
+
+ rTarget.SetBackground(GetBackground());
+ rTarget.Erase();
+
+ aGraphic.Draw(&rTarget, Point(), aGraphSize);
+ }
+
+ const Region aRepaintRegion(rRect);
+ pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion);
+ pView->EndCompleteRedraw(*pPaintWindow, true);
+ }
+ else
+ {
+ // #i73381# in non-SdrMode, paint to local directly
+ if(bGraphicValid)
+ {
+ aGraphic.Draw(this, Point(), aGraphSize);
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SdrObjChanged( const SdrObject& )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SdrObjCreated( const SdrObject& )
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MarkListHasChanged()
+{
+ if ( aMarkObjLink.IsSet() )
+ aMarkObjLink.Call( this );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode( rKEvt.GetKeyCode() );
+ sal_Bool bProc = sal_False;
+
+ switch ( aCode.GetCode() )
+ {
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if ( bSdrMode )
+ {
+ pView->DeleteMarked();
+ bProc = sal_True;
+ if( !pView->AreObjectsMarked() )
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ }
+ break;
+
+ case KEY_ESCAPE:
+ {
+ if ( bSdrMode )
+ {
+ if ( pView->IsAction() )
+ {
+ pView->BrkAction();
+ }
+ else if ( pView->AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ }
+ else
+ {
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+ bProc = sal_True;
+ }
+ }
+ break;
+
+ case KEY_F11:
+ case KEY_TAB:
+ {
+ if( bSdrMode )
+ {
+ if( !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ bool bForward = !aCode.IsShift();
+ // select next object
+ if ( ! pView->MarkNextObj( bForward ))
+ {
+ // At first or last object. Cycle to the other end
+ // of the list.
+ pView->UnmarkAllObj();
+ pView->MarkNextObj (bForward);
+ }
+ bProc = sal_True;
+ }
+ else if(aCode.IsMod1())
+ {
+ // select next handle
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ sal_Bool bForward(!aCode.IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+
+ bProc = true;
+ }
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+
+ if ( aCode.IsMod1() )
+ {
+ // #97016# mark last object
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_False);
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ if ( aCode.IsMod1() )
+ {
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_True);
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ long nX = 0;
+ long nY = 0;
+
+ if (aCode.GetCode() == KEY_UP)
+ {
+ // Scroll nach oben
+ nX = 0;
+ nY =-1;
+ }
+ else if (aCode.GetCode() == KEY_DOWN)
+ {
+ // Scroll nach unten
+ nX = 0;
+ nY = 1;
+ }
+ else if (aCode.GetCode() == KEY_LEFT)
+ {
+ // Scroll nach links
+ nX =-1;
+ nY = 0;
+ }
+ else if (aCode.GetCode() == KEY_RIGHT)
+ {
+ // Scroll nach rechts
+ nX = 1;
+ nY = 0;
+ }
+
+ if (pView->AreObjectsMarked() && !aCode.IsMod1() )
+ {
+ if(aCode.IsMod2())
+ {
+ // #97016# move in 1 pixel distance
+ Size aLogicSizeOnePixel = PixelToLogic(Size(1,1));
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ // #97016# II
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(0L == pHdl)
+ {
+ // #90129# restrict movement to WorkArea
+ const Rectangle& rWorkArea = pView->GetWorkArea();
+
+ if(!rWorkArea.IsEmpty())
+ {
+ Rectangle aMarkRect(pView->GetMarkedObjRect());
+ aMarkRect.Move(nX, nY);
+
+ if(!aMarkRect.IsInside(rWorkArea))
+ {
+ if(aMarkRect.Left() < rWorkArea.Left())
+ {
+ nX += rWorkArea.Left() - aMarkRect.Left();
+ }
+
+ if(aMarkRect.Right() > rWorkArea.Right())
+ {
+ nX -= aMarkRect.Right() - rWorkArea.Right();
+ }
+
+ if(aMarkRect.Top() < rWorkArea.Top())
+ {
+ nY += rWorkArea.Top() - aMarkRect.Top();
+ }
+
+ if(aMarkRect.Bottom() > rWorkArea.Bottom())
+ {
+ nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
+ }
+ }
+ }
+
+ // no handle selected
+ if(0 != nX || 0 != nY)
+ {
+ pView->MoveAllMarked(Size(nX, nY));
+ }
+ }
+ else
+ {
+ // move handle with index nHandleIndex
+ if(pHdl && (nX || nY))
+ {
+ // now move the Handle (nX, nY)
+ Point aStartPoint(pHdl->GetPos());
+ Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
+ const SdrDragStat& rDragStat = pView->GetDragStat();
+
+ // start dragging
+ pView->BegDragObj(aStartPoint, 0, pHdl, 0);
+
+ if(pView->IsDragObj())
+ {
+ FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
+ sal_Bool bWasSnapEnabled = pView->IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
+ if(bWasSnapEnabled)
+ pView->SetSnapEnabled(sal_False);
+
+ pView->MovAction(aEndPoint);
+ pView->EndDragObj();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ pView->SetSnapEnabled(bWasSnapEnabled);
+ }
+ }
+ }
+
+ bProc = true;
+ }
+ }
+ break;
+
+ case KEY_SPACE:
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ if(pHdl->GetKind() == HDL_POLY)
+ {
+ // rescue ID of point with focus
+ sal_uInt32 nPol(pHdl->GetPolyNum());
+ sal_uInt32 nPnt(pHdl->GetPointNum());
+
+ if(pView->IsPointMarked(*pHdl))
+ {
+ if(rKEvt.GetKeyCode().IsShift())
+ {
+ pView->UnmarkPoint(*pHdl);
+ }
+ }
+ else
+ {
+ if(!rKEvt.GetKeyCode().IsShift())
+ {
+ pView->UnmarkAllPoints();
+ }
+
+ pView->MarkPoint(*pHdl);
+ }
+
+ if(0L == rHdlList.GetFocusHdl())
+ {
+ // restore point with focus
+ SdrHdl* pNewOne = 0L;
+
+ for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
+ {
+ SdrHdl* pAct = rHdlList.GetHdl(a);
+
+ if(pAct
+ && pAct->GetKind() == HDL_POLY
+ && pAct->GetPolyNum() == nPol
+ && pAct->GetPointNum() == nPnt)
+ {
+ pNewOne = pAct;
+ }
+ }
+
+ if(pNewOne)
+ {
+ ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+ }
+ }
+
+ bProc = sal_True;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ( !bProc )
+ Control::KeyInput( rKEvt );
+ else
+ ReleaseMouse();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( bSdrMode && ( rMEvt.GetClicks() < 2 ) )
+ {
+ const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( !Rectangle( Point(), aGraphSize ).IsInside( aLogPt ) && !pView->IsEditMode() )
+ Control::MouseButtonDown( rMEvt );
+ else
+ {
+ // Focus anziehen fuer Key-Inputs
+ GrabFocus();
+
+ if ( nPolyEdit )
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pView->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
+
+ if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SDRHIT_MARKEDOBJECT )
+ pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1());
+ else
+ pView->MouseButtonDown( rMEvt, this );
+ }
+ else
+ pView->MouseButtonDown( rMEvt, this );
+ }
+
+ SdrObject* pCreateObj = pView->GetCreateObj();
+
+ // Wir wollen das Inserten mitbekommen
+ if ( pCreateObj && !pCreateObj->GetUserCall() )
+ pCreateObj->SetUserCall( pUserCall );
+
+ SetPointer( pView->GetPreferedPointer( aLogPt, this ) );
+ }
+ else
+ Control::MouseButtonDown( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseMove(const MouseEvent& rMEvt)
+{
+ const Point aLogPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( bSdrMode )
+ {
+ pView->MouseMove( rMEvt, this );
+
+ if( ( SID_BEZIER_INSERT == nPolyEdit ) &&
+ !pView->PickHandle( aLogPos ) &&
+ !pView->IsInsObjPoint() )
+ {
+ SetPointer( POINTER_CROSS );
+ }
+ else
+ SetPointer( pView->GetPreferedPointer( aLogPos, this ) );
+ }
+ else
+ Control::MouseButtonUp( rMEvt );
+
+ if ( aMousePosLink.IsSet() )
+ {
+ if ( Rectangle( Point(), aGraphSize ).IsInside( aLogPos ) )
+ aMousePos = aLogPos;
+ else
+ aMousePos = Point();
+
+ aMousePosLink.Call( this );
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if ( bSdrMode )
+ {
+ if ( pView->IsInsObjPoint() )
+ pView->EndInsObjPoint( SDRCREATE_FORCEEND );
+ else
+ pView->MouseButtonUp( rMEvt, this );
+
+ ReleaseMouse();
+ SetPointer( pView->GetPreferedPointer( PixelToLogic( rMEvt.GetPosPixel() ), this ) );
+ }
+ else
+ Control::MouseButtonUp( rMEvt );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* GraphCtrl::GetSelectedSdrObject() const
+{
+ SdrObject* pSdrObj = NULL;
+
+ if ( bSdrMode )
+ {
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ }
+
+ return pSdrObj;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetEditMode( const sal_Bool _bEditMode )
+{
+ if ( bSdrMode )
+ {
+ bEditMode = _bEditMode;
+ pView->SetEditMode( bEditMode );
+ eObjKind = OBJ_NONE;
+ pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) );
+ }
+ else
+ bEditMode = sal_False;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit )
+{
+ if ( bSdrMode && ( _nPolyEdit != nPolyEdit ) )
+ {
+ nPolyEdit = _nPolyEdit;
+ pView->SetFrameDragSingles( nPolyEdit == 0 );
+ }
+ else
+ nPolyEdit = 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphCtrl::SetObjKind( const SdrObjKind _eObjKind )
+{
+ if ( bSdrMode )
+ {
+ bEditMode = sal_False;
+ pView->SetEditMode( bEditMode );
+ eObjKind = _eObjKind;
+ pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) );
+ }
+ else
+ eObjKind = OBJ_NONE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+String GraphCtrl::GetStringFromDouble( const double& rDouble )
+{
+ sal_Unicode cSep =
+ SvtSysLocale().GetLocaleData().getNumDecimalSep().GetChar(0);
+ String aStr( ::rtl::math::doubleToUString( rDouble,
+ rtl_math_StringFormat_F, 2, cSep ));
+ return aStr;
+}
+
+
+/*************************************************************************
+www|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( GraphCtrl, UpdateHdl, Timer*, pTimer )
+{
+ if ( aUpdateLink.IsSet() )
+ aUpdateLink.Call( this );
+
+ pTimer->Start();
+
+ return 0L;
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GraphCtrl::CreateAccessible()
+{
+ if( mpAccContext == NULL )
+ {
+ Window* pParent = GetParent();
+
+ DBG_ASSERT( pParent, "-GraphCtrl::CreateAccessible(): No Parent!" );
+
+ if( pParent )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccParent( pParent->GetAccessible() );
+
+ // #103856# Disable accessibility if no model/view data available
+ if( pView &&
+ pModel &&
+ xAccParent.is() )
+ {
+ mpAccContext = new SvxGraphCtrlAccessibleContext( xAccParent, *this );
+ mpAccContext->acquire();
+ }
+ }
+ }
+
+ return mpAccContext;
+}
diff --git a/svx/source/dialog/grfflt.cxx b/svx/source/dialog/grfflt.cxx
new file mode 100644
index 000000000000..53cead9f00cf
--- /dev/null
+++ b/svx/source/dialog/grfflt.cxx
@@ -0,0 +1,793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+#ifndef _SFXOBJSH_HXX
+#include <sfx2/objsh.hxx>
+#endif
+#include <sfx2/request.hxx>
+
+#include <svx/dialmgr.hxx>
+#include <svx/grfflt.hxx>
+//#include "grfflt.hrc"
+#include <svx/dialogs.hrc>
+#include <svx/svxdlg.hxx> //CHINA001
+
+// --------------------
+// - SvxGraphicFilter -
+// --------------------
+
+sal_uIntPtr SvxGraphicFilter::ExecuteGrfFilterSlot( SfxRequest& rReq, GraphicObject& rFilterObject )
+{
+ const Graphic& rGraphic = rFilterObject.GetGraphic();
+ sal_uIntPtr nRet = SVX_GRAPHICFILTER_UNSUPPORTED_GRAPHICTYPE;
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : NULL;
+ Window* pWindow = ( pViewFrame && pViewFrame->GetViewShell() ) ? pViewFrame->GetViewShell()->GetWindow() : NULL;
+ Graphic aGraphic;
+
+ switch( rReq.GetSlot() )
+ {
+ case( SID_GRFFILTER_INVERT ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Invert() )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Invert() )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SMOOTH ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SMOOTH ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SHARPEN ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SHARPEN ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_REMOVENOISE ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_REMOVENOISE ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SOBEL ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOBEL_GREY ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_MOSAIC ):
+ {
+ //CHINA001 GraphicFilterMosaic aDlg( pWindow, rGraphic, 4, 4, sal_False );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterMosaic( pWindow, rGraphic, 4, 4, sal_False, RID_SVX_GRFFILTER_DLG_MOSAIC);
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_EMBOSS ):
+ {
+ //CHINA001 GraphicFilterEmboss aDlg( pWindow, rGraphic, RP_MM );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterEmboss( pWindow, rGraphic, RP_MM, RID_SVX_GRFFILTER_DLG_EMBOSS );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_POSTER ):
+ {
+ //CHINA001 GraphicFilterPoster aDlg( pWindow, rGraphic, 16 );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 16, RID_SVX_GRFFILTER_DLG_POSTER );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_POPART ):
+ {
+ if( pShell )
+ pShell->SetWaitCursor( sal_True );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnimation( rGraphic.GetAnimation() );
+
+ if( aAnimation.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aAnimation;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_POPART ) )
+ aGraphic = aBmpEx;
+ }
+
+ if( pShell )
+ pShell->SetWaitCursor( sal_False );
+ }
+ break;
+
+ case( SID_GRFFILTER_SEPIA ):
+ {
+ //CHINA001 GraphicFilterSepia aDlg( pWindow, rGraphic, 10 );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterPosterSepia( pWindow, rGraphic, 10, RID_SVX_GRFFILTER_DLG_SEPIA );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case( SID_GRFFILTER_SOLARIZE ):
+ {
+ //CHINA001 GraphicFilterSolarize aDlg( pWindow, rGraphic, 128, sal_False );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractGraphicFilterDialog* aDlg = pFact->CreateGraphicFilterSolarize( pWindow, rGraphic, 128, sal_False, RID_SVX_GRFFILTER_DLG_SOLARIZE );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ if( aDlg->Execute() == RET_OK ) //CHINA001 if( aDlg.Execute() == RET_OK )
+ aGraphic = aDlg->GetFilteredGraphic( rGraphic, 1.0, 1.0 ); //CHINA001 aGraphic = aDlg.GetFilteredGraphic( rGraphic, 1.0, 1.0 );
+ delete aDlg; //add by CHINA001
+ }
+ }
+ break;
+
+ case SID_GRFFILTER :
+ {
+ // do nothing; no error
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ break;
+ }
+
+ default:
+ {
+ DBG_ERROR( "SvxGraphicFilter: selected filter slot not yet implemented" );
+ nRet = SVX_GRAPHICFILTER_UNSUPPORTED_SLOT;
+ }
+ break;
+ }
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ rFilterObject.SetGraphic( aGraphic );
+ nRet = SVX_GRAPHICFILTER_ERRCODE_NONE;
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SvxGraphicFilter::DisableGraphicFilterSlots( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER ) )
+ rSet.DisableItem( SID_GRFFILTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_INVERT ) )
+ rSet.DisableItem( SID_GRFFILTER_INVERT );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SMOOTH ) )
+ rSet.DisableItem( SID_GRFFILTER_SMOOTH );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SHARPEN ) )
+ rSet.DisableItem( SID_GRFFILTER_SHARPEN );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_REMOVENOISE ) )
+ rSet.DisableItem( SID_GRFFILTER_REMOVENOISE );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOBEL ) )
+ rSet.DisableItem( SID_GRFFILTER_SOBEL );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_MOSAIC ) )
+ rSet.DisableItem( SID_GRFFILTER_MOSAIC );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_EMBOSS ) )
+ rSet.DisableItem( SID_GRFFILTER_EMBOSS );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POSTER ) )
+ rSet.DisableItem( SID_GRFFILTER_POSTER );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_POPART ) )
+ rSet.DisableItem( SID_GRFFILTER_POPART );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SEPIA ) )
+ rSet.DisableItem( SID_GRFFILTER_SEPIA );
+
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( SID_GRFFILTER_SOLARIZE ) )
+ rSet.DisableItem( SID_GRFFILTER_SOLARIZE );
+};
+/* CHINA001 move to cuigrfflt.cxx
+// --------------------------------------
+// - GraphicFilterDialog::PreviewWindow -
+// --------------------------------------
+
+GraphicFilterDialog::PreviewWindow::PreviewWindow( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::PreviewWindow::~PreviewWindow()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::Paint( const Rectangle& rRect )
+{
+ Control::Paint( rRect );
+
+ const Size aGrfSize( LogicToPixel( maGraphic.GetPrefSize(), maGraphic.GetPrefMapMode() ) );
+ const Size aOutSize( GetOutputSizePixel() );
+ const Point aGrfPos( ( aOutSize.Width() - aGrfSize.Width() ) >> 1,
+ ( aOutSize.Height() - aGrfSize.Height() ) >> 1 );
+
+ if( maGraphic.IsAnimated() )
+ maGraphic.StartAnimation( this , aGrfPos, aGrfSize );
+ else
+ maGraphic.Draw( this, aGrfPos, aGrfSize );
+}
+
+// -----------------------------------------------------------------------------
+
+void GraphicFilterDialog::PreviewWindow::SetGraphic( const Graphic& rGraphic )
+{
+ maGraphic = rGraphic;
+
+ if( maGraphic.IsAnimated() || maGraphic.IsTransparent() )
+ Invalidate();
+ else
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+}
+
+// -----------------------
+// - GraphicFilterDialog -
+// -----------------------
+
+GraphicFilterDialog::GraphicFilterDialog( Window* pParent, const ResId& rResId, const Graphic& rGraphic ) :
+ ModalDialog ( pParent, rResId ),
+ mfScaleX ( 0.0 ),
+ mfScaleY ( 0.0 ),
+ maSizePixel ( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ),
+ maModifyHdl ( LINK( this, GraphicFilterDialog, ImplModifyHdl ) ),
+ maPreview ( this, SVX_RES( CTL_PREVIEW ) ),
+ maFlParameter ( this, SVX_RES( FL_PARAMETER ) ),
+ maBtnOK ( this, SVX_RES( BTN_OK ) ),
+ maBtnCancel ( this, SVX_RES( BTN_CANCEL ) ),
+ maBtnHelp ( this, SVX_RES( BTN_HELP ) )
+{
+ const Size aPreviewSize( maPreview.GetOutputSizePixel() );
+ Size aGrfSize( maSizePixel );
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP &&
+ aPreviewSize.Width() && aPreviewSize.Height() &&
+ aGrfSize.Width() && aGrfSize.Height() )
+ {
+ const double fGrfWH = (double) aGrfSize.Width() / aGrfSize.Height();
+ const double fPreWH = (double) aPreviewSize.Width() / aPreviewSize.Height();
+
+ if( fGrfWH < fPreWH )
+ {
+ aGrfSize.Width() = (long) ( aPreviewSize.Height() * fGrfWH );
+ aGrfSize.Height()= aPreviewSize.Height();
+ }
+ else
+ {
+ aGrfSize.Width() = aPreviewSize.Width();
+ aGrfSize.Height()= (long) ( aPreviewSize.Width() / fGrfWH);
+ }
+
+ mfScaleX = (double) aGrfSize.Width() / maSizePixel.Width();
+ mfScaleY = (double) aGrfSize.Height() / maSizePixel.Height();
+
+ if( !rGraphic.IsAnimated() )
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Scale( aGrfSize, BMP_SCALE_INTERPOLATE ) )
+ maGraphic = aBmpEx;
+ }
+ }
+
+ maTimer.SetTimeoutHdl( LINK( this, GraphicFilterDialog, ImplPreviewTimeoutHdl ) );
+ maTimer.SetTimeout( 100 );
+ ImplModifyHdl( NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterDialog::~GraphicFilterDialog()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplPreviewTimeoutHdl, Timer*, pTimer )
+{
+ maTimer.Stop();
+ maPreview.SetGraphic( GetFilteredGraphic( maGraphic, mfScaleX, mfScaleY ) );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilterDialog, ImplModifyHdl, void*, p )
+{
+ if( maGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ maTimer.Stop();
+ maTimer.Start();
+ }
+
+ return 0;
+}
+
+// ----------------
+// - FilterMosaic -
+// ----------------
+
+GraphicFilterMosaic::GraphicFilterMosaic( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nTileWidth, sal_uInt16 nTileHeight, sal_Bool bEnhanceEdges ) :
+ GraphicFilterDialog( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_MOSAIC ), rGraphic ),
+ maFtWidth ( this, SVX_RES( DLG_FILTERMOSAIC_FT_WIDTH ) ),
+ maMtrWidth ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_WIDTH ) ),
+ maFtHeight ( this, SVX_RES( DLG_FILTERMOSAIC_FT_HEIGHT ) ),
+ maMtrHeight ( this, SVX_RES( DLG_FILTERMOSAIC_MTR_HEIGHT ) ),
+ maCbxEdges ( this, SVX_RES( DLG_FILTERMOSAIC_CBX_EDGES ) )
+{
+ FreeResource();
+
+ maMtrWidth.SetValue( nTileWidth );
+ maMtrWidth.SetLast( GetGraphicSizePixel().Width() );
+ maMtrWidth.SetModifyHdl( GetModifyHdl() );
+
+ maMtrHeight.SetValue( nTileHeight );
+ maMtrHeight.SetLast( GetGraphicSizePixel().Height() );
+ maMtrHeight.SetModifyHdl( GetModifyHdl() );
+
+ maCbxEdges.Check( bEnhanceEdges );
+ maCbxEdges.SetToggleHdl( GetModifyHdl() );
+
+ maMtrWidth.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterMosaic::~GraphicFilterMosaic()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterMosaic::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ const Size aSize( Max( FRound( GetTileWidth() * fScaleX ), 1L ),
+ Max( FRound( GetTileHeight() * fScaleY ), 1L ) );
+ BmpFilterParam aParam( aSize );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aAnim.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_MOSAIC, &aParam ) )
+ {
+ if( IsEnhanceEdges() )
+ aBmpEx.Filter( BMP_FILTER_SHARPEN );
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ------------------
+// - GraphicFilterSolarize -
+// ------------------
+
+GraphicFilterSolarize::GraphicFilterSolarize( Window* pParent, const Graphic& rGraphic,
+ sal_uInt8 cGreyThreshold, sal_Bool bInvert ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SOLARIZE ), rGraphic ),
+ maFtThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_FT_THRESHOLD ) ),
+ maMtrThreshold ( this, SVX_RES( DLG_FILTERSOLARIZE_MTR_THRESHOLD ) ),
+ maCbxInvert ( this, SVX_RES( DLG_FILTERSOLARIZE_CBX_INVERT ) )
+{
+ FreeResource();
+
+ maMtrThreshold.SetValue( FRound( cGreyThreshold / 2.55 ) );
+ maMtrThreshold.SetModifyHdl( GetModifyHdl() );
+
+ maCbxInvert.Check( bInvert );
+ maCbxInvert.SetToggleHdl( GetModifyHdl() );
+
+ maMtrThreshold.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSolarize::~GraphicFilterSolarize()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSolarize::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetGreyThreshold() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aAnim.Invert();
+
+ aRet = aAnim;
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SOLARIZE, &aParam ) )
+ {
+ if( IsInvert() )
+ aBmpEx.Invert();
+
+ aRet = aBmpEx;
+ }
+ }
+
+ return aRet;
+}
+
+// ----------------------
+// - GraphicFilterSepia -
+// ----------------------
+
+GraphicFilterSepia::GraphicFilterSepia( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nSepiaPercent ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_SEPIA ), rGraphic ),
+ maFtSepia ( this, SVX_RES( DLG_FILTERSEPIA_FT_SEPIA ) ),
+ maMtrSepia ( this, SVX_RES( DLG_FILTERSEPIA_MTR_SEPIA ) )
+{
+ FreeResource();
+
+ maMtrSepia.SetValue( nSepiaPercent );
+ maMtrSepia.SetModifyHdl( GetModifyHdl() );
+
+ maMtrSepia.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterSepia::~GraphicFilterSepia()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterSepia::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ BmpFilterParam aParam( GetSepiaPercent() );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_SEPIA, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterPoster -
+// -----------------------
+
+GraphicFilterPoster::GraphicFilterPoster( Window* pParent, const Graphic& rGraphic,
+ sal_uInt16 nPosterCount ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_POSTER ), rGraphic ),
+ maFtPoster ( this, SVX_RES( DLG_FILTERPOSTER_FT_POSTER ) ),
+ maNumPoster ( this, SVX_RES( DLG_FILTERPOSTER_NUM_POSTER ) )
+{
+ FreeResource();
+
+ maNumPoster.SetFirst( 2 );
+ maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() );
+ maNumPoster.SetValue( nPosterCount );
+ maNumPoster.SetModifyHdl( GetModifyHdl() );
+ maNumPoster.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterPoster::~GraphicFilterPoster()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterPoster::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ const sal_uInt16 nPosterCount = GetPosterColorCount();
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.ReduceColors( nPosterCount, BMP_REDUCE_POPULAR ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+
+// -----------------------
+// - GraphicFilterEmboss -
+// -----------------------
+
+void GraphicFilterEmboss::EmbossControl::MouseButtonDown( const MouseEvent& rEvt )
+{
+ const RECT_POINT eOldRP = GetActualRP();
+
+ SvxRectCtl::MouseButtonDown( rEvt );
+
+ if( GetActualRP() != eOldRP )
+ maModifyHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::GraphicFilterEmboss( Window* pParent, const Graphic& rGraphic,
+ RECT_POINT eLightSource ) :
+ GraphicFilterDialog ( pParent, SVX_RES( RID_SVX_GRFFILTER_DLG_EMBOSS ), rGraphic ),
+ maFtLight ( this, SVX_RES( DLG_FILTEREMBOSS_FT_LIGHT ) ),
+ maCtlLight ( this, SVX_RES( DLG_FILTEREMBOSS_CTL_LIGHT ), eLightSource )
+{
+ FreeResource();
+
+ maCtlLight.SetModifyHdl( GetModifyHdl() );
+ maCtlLight.GrabFocus();
+}
+
+// -----------------------------------------------------------------------------
+
+GraphicFilterEmboss::~GraphicFilterEmboss()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+Graphic GraphicFilterEmboss::GetFilteredGraphic( const Graphic& rGraphic,
+ double fScaleX, double fScaleY )
+{
+ Graphic aRet;
+ sal_uInt16 nAzim, nElev;
+
+ switch( maCtlLight.GetActualRP() )
+ {
+ case( RP_LT ): nAzim = 4500, nElev = 4500; break;
+ case( RP_MT ): nAzim = 9000, nElev = 4500; break;
+ case( RP_RT ): nAzim = 13500, nElev = 4500; break;
+ case( RP_LM ): nAzim = 0, nElev = 4500; break;
+ case( RP_MM ): nAzim = 0, nElev = 9000; break;
+ case( RP_RM ): nAzim = 18000, nElev = 4500; break;
+ case( RP_LB ): nAzim = 31500, nElev = 4500; break;
+ case( RP_MB ): nAzim = 27000, nElev = 4500; break;
+ case( RP_RB ): nAzim = 22500, nElev = 4500; break;
+ }
+
+ BmpFilterParam aParam( nAzim, nElev );
+
+ if( rGraphic.IsAnimated() )
+ {
+ Animation aAnim( rGraphic.GetAnimation() );
+
+ if( aAnim.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aAnim;
+ }
+ else
+ {
+ BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
+
+ if( aBmpEx.Filter( BMP_FILTER_EMBOSS_GREY, &aParam ) )
+ aRet = aBmpEx;
+ }
+
+ return aRet;
+}
+*/
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
new file mode 100644
index 000000000000..67e34801ca34
--- /dev/null
+++ b/svx/source/dialog/hdft.cxx
@@ -0,0 +1,983 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <svl/itemiter.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/graph.hxx>
+
+#include <sfx2/sfxsids.hrc>
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include "hdft.hrc"
+#include <svl/intitem.hxx>
+
+#define _SVX_HDFT_CXX
+
+#include <svx/hdft.hxx>
+#include <svx/pageitem.hxx>
+//CHINA001 #include "bbdlg.hxx"
+#include "svx/dlgutil.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/htmlmode.hxx"
+
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/boxitem.hxx>
+
+#include <svx/svxdlg.hxx> //CHINA001
+#include <svx/dialogs.hrc> //CHINA001
+// static ----------------------------------------------------------------
+
+// --> OD 2004-06-18 #i19922#
+//static const long MINBODY = 284; // 0,5cm in twips aufgerundet
+static const long MINBODY = 56; // 1mm in twips rounded
+
+// default distance to Header or footer
+static const long DEF_DIST_WRITER = 500; // 5mm (Writer)
+static const long DEF_DIST_CALC = 250; // 2,5mm (Calc)
+
+static sal_uInt16 pRanges[] =
+{
+ SID_ATTR_BRUSH, SID_ATTR_BRUSH,
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
+ SID_ATTR_LRSPACE, SID_ATTR_LRSPACE,
+ SID_ATTR_ULSPACE, SID_ATTR_ULSPACE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_HEADERSET,
+ SID_ATTR_PAGE_FOOTERSET, SID_ATTR_PAGE_FOOTERSET,
+ SID_ATTR_PAGE_ON, SID_ATTR_PAGE_ON,
+ SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
+ SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
+ SID_ATTR_HDFT_DYNAMIC_SPACING, SID_ATTR_HDFT_DYNAMIC_SPACING,
+ 0
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// gibt den Bereich der Which-Werte zurueck
+
+
+sal_uInt16* SvxHeaderPage::GetRanges()
+{
+ return pRanges;
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxHeaderPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxHeaderPage( pParent, rSet );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16* SvxFooterPage::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SvxFooterPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SvxFooterPage( pParent, rSet );
+}
+
+// -----------------------------------------------------------------------
+
+SvxHeaderPage::SvxHeaderPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SvxHFPage( pParent, RID_SVXPAGE_HEADER, rAttr, SID_ATTR_PAGE_HEADERSET )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) :
+
+ SvxHFPage( pParent, RID_SVXPAGE_FOOTER, rAttr, SID_ATTR_PAGE_FOOTERSET )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) :
+
+ SfxTabPage( pParent, SVX_RES( nResId ), rAttr ),
+
+ aTurnOnBox ( this, SVX_RES( CB_TURNON ) ),
+ aCntSharedBox ( this, SVX_RES( CB_SHARED ) ),
+ aLMLbl ( this, SVX_RES( FT_LMARGIN ) ),
+ aLMEdit ( this, SVX_RES( ED_LMARGIN ) ),
+ aRMLbl ( this, SVX_RES( FT_RMARGIN ) ),
+ aRMEdit ( this, SVX_RES( ED_RMARGIN ) ),
+ aDistFT ( this, SVX_RES( FT_DIST ) ),
+ aDistEdit ( this, SVX_RES( ED_DIST ) ),
+ aDynSpacingCB ( this, SVX_RES( CB_DYNSPACING ) ),
+ aHeightFT ( this, SVX_RES( FT_HEIGHT ) ),
+ aHeightEdit ( this, SVX_RES( ED_HEIGHT ) ),
+ aHeightDynBtn ( this, SVX_RES( CB_HEIGHT_DYN ) ),
+ aFrm ( this, SVX_RES( FL_FRAME ) ),
+ aBspWin ( this, SVX_RES( WN_BSP ) ),
+ aBackgroundBtn ( this, SVX_RES( BTN_EXTRAS ) ),
+
+ nId ( nSetId ),
+ pBBSet ( NULL ),
+ bDisableQueryBox ( sal_False ),
+ bEnableBackgroundSelector ( sal_True )
+
+{
+ InitHandler();
+ aBspWin.EnableRTL( sal_False );
+
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ FreeResource();
+
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( rAttr );
+ SetFieldUnit( aDistEdit, eFUnit );
+ SetFieldUnit( aHeightEdit, eFUnit );
+ SetFieldUnit( aLMEdit, eFUnit );
+ SetFieldUnit( aRMEdit, eFUnit );
+}
+
+// -----------------------------------------------------------------------
+
+SvxHFPage::~SvxHFPage()
+{
+ delete pBBSet;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet )
+{
+ const sal_uInt16 nWSize = GetWhich( SID_ATTR_PAGE_SIZE );
+ const sal_uInt16 nWLRSpace = GetWhich( SID_ATTR_LRSPACE );
+ const sal_uInt16 nWULSpace = GetWhich( SID_ATTR_ULSPACE );
+ const sal_uInt16 nWOn = GetWhich( SID_ATTR_PAGE_ON );
+ const sal_uInt16 nWDynamic = GetWhich( SID_ATTR_PAGE_DYNAMIC );
+ const sal_uInt16 nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING );
+ const sal_uInt16 nWShared = GetWhich( SID_ATTR_PAGE_SHARED );
+ const sal_uInt16 nWBrush = GetWhich( SID_ATTR_BRUSH );
+ const sal_uInt16 nWBox = GetWhich( SID_ATTR_BORDER_OUTER );
+ const sal_uInt16 nWBoxInfo = GetWhich( SID_ATTR_BORDER_INNER );
+ const sal_uInt16 nWShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
+ const sal_uInt16 aWhichTab[] = { nWSize, nWSize,
+ nWLRSpace, nWLRSpace,
+ nWULSpace, nWULSpace,
+ nWOn, nWOn,
+ nWDynamic, nWDynamic,
+ nWShared, nWShared,
+ nWBrush, nWBrush,
+ nWBoxInfo, nWBoxInfo,
+ nWBox, nWBox,
+ nWShadow, nWShadow,
+ nWDynSpacing, nWDynSpacing,
+ 0 };
+ const SfxItemSet& rOldSet = GetItemSet();
+ SfxItemPool* pPool = rOldSet.GetPool();
+ DBG_ASSERT( pPool, "no pool :-(" );
+ SfxMapUnit eUnit = pPool->GetMetric( nWSize );
+ SfxItemSet aSet ( *pPool, aWhichTab );
+
+ //--------------------------------------------------------------------
+
+ aSet.Put( SfxBoolItem( nWOn, aTurnOnBox.IsChecked() ) );
+ aSet.Put( SfxBoolItem( nWDynamic, aHeightDynBtn.IsChecked() ) );
+ aSet.Put( SfxBoolItem( nWShared, aCntSharedBox.IsChecked() ) );
+ if(aDynSpacingCB.IsVisible() && SFX_WHICH_MAX > nWDynSpacing)
+ {
+ SfxBoolItem* pBoolItem = (SfxBoolItem*)pPool->GetDefaultItem(nWDynSpacing).Clone();
+ pBoolItem->SetValue(aDynSpacingCB.IsChecked());
+ aSet.Put(*pBoolItem);
+ delete pBoolItem;
+ }
+
+ // Groesse
+ SvxSizeItem aSizeItem( (const SvxSizeItem&)rOldSet.Get( nWSize ) );
+ Size aSize( aSizeItem.GetSize() );
+ long nDist = GetCoreValue( aDistEdit, eUnit );
+ long nH = GetCoreValue( aHeightEdit, eUnit );
+
+ // fixe Hoehe?
+// if ( !aHeightDynBtn.IsChecked() )
+ nH += nDist; // dann Abstand dazu addieren
+ aSize.Height() = nH;
+ aSizeItem.SetSize( aSize );
+ aSet.Put( aSizeItem );
+
+ // Raender
+ SvxLRSpaceItem aLR( nWLRSpace );
+ aLR.SetLeft( (sal_uInt16)GetCoreValue( aLMEdit, eUnit ) );
+ aLR.SetRight( (sal_uInt16)GetCoreValue( aRMEdit, eUnit ) );
+ aSet.Put( aLR );
+
+ SvxULSpaceItem aUL( nWULSpace );
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aUL.SetLower( (sal_uInt16)nDist );
+ else
+ aUL.SetUpper( (sal_uInt16)nDist );
+ aSet.Put( aUL );
+
+ // Hintergrund und Umrandung?
+ if ( pBBSet )
+ aSet.Put( *pBBSet );
+ else
+ {
+ const SfxItemSet* _pSet;
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
+ {
+ _pSet = &( (SvxSetItem*)pItem )->GetItemSet();
+
+ if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) );
+ if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) );
+ if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) );
+ if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET )
+ aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) );
+ }
+ }
+
+ // Das SetItem wegschreiben
+ SvxSetItem aSetItem( GetWhich( nId ), aSet );
+ rSet.Put( aSetItem );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+void SvxHFPage::Reset( const SfxItemSet& rSet )
+{
+ ActivatePage( rSet );
+ ResetBackground_Impl( rSet );
+
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Wo ist der Pool" );
+ SfxMapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_PAGE_SIZE ) );
+
+ // Kopf-/Fusszeilen-Attribute auswerten
+ //
+ const SvxSetItem* pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich(nId), sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_PAGE_ON));
+
+ aTurnOnBox.Check(rHeaderOn.GetValue());
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SfxBoolItem& rDynamic =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_DYNAMIC ) );
+ const SfxBoolItem& rShared =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED ) );
+ const SvxSizeItem& rSize =
+ (const SvxSizeItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL =
+ (const SvxULSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR =
+ (const SvxLRSpaceItem&)rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ if(aDynSpacingCB.IsVisible())
+ {
+ const SfxBoolItem& rDynSpacing =
+ (const SfxBoolItem&)rHeaderSet.Get(GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING));
+ aDynSpacingCB.Check(rDynSpacing.GetValue());
+ }
+
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ { // Kopfzeile
+ SetMetricValue( aDistEdit, rUL.GetLower(), eUnit );
+ SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetLower(), eUnit );
+ }
+ else
+ { // Fusszeile
+ SetMetricValue( aDistEdit, rUL.GetUpper(), eUnit );
+ SetMetricValue( aHeightEdit, rSize.GetSize().Height() - rUL.GetUpper(), eUnit );
+ }
+
+ aHeightDynBtn.Check(rDynamic.GetValue());
+ SetMetricValue( aLMEdit, rLR.GetLeft(), eUnit );
+ SetMetricValue( aRMEdit, rLR.GetRight(), eUnit );
+ aCntSharedBox.Check(rShared.GetValue());
+ }
+ else
+ pSetItem = 0;
+ }
+ else
+ {
+ // defaults for distance and height
+ long nDefaultDist = DEF_DIST_WRITER;
+ const SfxPoolItem* pExt1 = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+ const SfxPoolItem* pExt2 = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
+
+ if ( pExt1 && pExt1->ISA(SfxBoolItem) && pExt2 && pExt2->ISA(SfxBoolItem) )
+ nDefaultDist = DEF_DIST_CALC;
+
+ SetMetricValue( aDistEdit, nDefaultDist, SFX_MAPUNIT_100TH_MM );
+ SetMetricValue( aHeightEdit, 500, SFX_MAPUNIT_100TH_MM );
+ }
+
+ if ( !pSetItem )
+ {
+ aTurnOnBox.Check( sal_False );
+ aHeightDynBtn.Check( sal_True );
+ aCntSharedBox.Check( sal_True );
+ }
+
+ TurnOnHdl(0);
+
+ aTurnOnBox.SaveValue();
+ aDistEdit.SaveValue();
+ aHeightEdit.SaveValue();
+ aHeightDynBtn.SaveValue();
+ aLMEdit.SaveValue();
+ aRMEdit.SaveValue();
+ aCntSharedBox.SaveValue();
+ RangeHdl( 0 );
+
+ sal_uInt16 nHtmlMode = 0;
+ const SfxPoolItem* pItem = 0;
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
+ ( 0 != (pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ {
+ nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
+ if(nHtmlMode && HTMLMODE_ON)
+ {
+ aCntSharedBox.Hide();
+ aBackgroundBtn.Hide();
+ }
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Handler initialisieren
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::InitHandler()
+{
+ aTurnOnBox.SetClickHdl(LINK(this, SvxHFPage, TurnOnHdl));
+ aDistEdit.SetModifyHdl(LINK(this, SvxHFPage, DistModify));
+ aDistEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+
+ aHeightEdit.SetModifyHdl(LINK(this, SvxHFPage, HeightModify));
+ aHeightEdit.SetLoseFocusHdl(LINK(this,SvxHFPage,RangeHdl));
+
+ aLMEdit.SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
+ aLMEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+ aRMEdit.SetModifyHdl(LINK(this, SvxHFPage, BorderModify));
+ aRMEdit.SetLoseFocusHdl(LINK(this, SvxHFPage, RangeHdl));
+ aBackgroundBtn.SetClickHdl(LINK(this,SvxHFPage, BackgroundHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ein/aus
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
+{
+ if ( aTurnOnBox.IsChecked() )
+ {
+ aDistFT.Enable();
+ aDistEdit.Enable();
+ aDynSpacingCB.Enable();
+ aHeightFT.Enable();
+ aHeightEdit.Enable();
+ aHeightDynBtn.Enable();
+ aLMLbl.Enable();
+ aLMEdit.Enable();
+ aRMLbl.Enable();
+ aRMEdit.Enable();
+
+ sal_uInt16 nUsage = aBspWin.GetUsage();
+
+ if( nUsage == SVX_PAGE_RIGHT || nUsage == SVX_PAGE_LEFT )
+ aCntSharedBox.Disable();
+ else
+ aCntSharedBox.Enable();
+ aBackgroundBtn.Enable();
+ }
+ else
+ {
+ sal_Bool bDelete = sal_True;
+
+ if ( !bDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True )
+ bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );
+
+ if ( bDelete )
+ {
+ aDistFT.Disable();
+ aDistEdit.Disable();
+ aDynSpacingCB.Enable(sal_False);
+ aHeightFT.Disable();
+ aHeightEdit.Disable();
+ aHeightDynBtn.Disable();
+
+ aLMLbl.Disable();
+ aLMEdit.Disable();
+ aRMLbl.Disable();
+ aRMEdit.Disable();
+
+ aCntSharedBox.Disable();
+ aBackgroundBtn.Disable();
+ }
+ else
+ aTurnOnBox.Check();
+ }
+ UpdateExample();
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Abstand im Bsp Modifizieren
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SvxHFPage, DistModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, DistModify, MetricField *, EMPTYARG )
+
+IMPL_LINK_INLINE_START( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, HeightModify, MetricField *, EMPTYARG )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Raender einstellen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
+{
+ UpdateExample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hintergrund
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG )
+{
+ if ( !pBBSet )
+ {
+ // nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen
+ sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH );
+ sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER );
+ sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False );
+ sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW );
+
+ // einen leeren Set erzeugenc
+ pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush,
+ nOuter, nOuter, nInner, nInner,
+ nShadow, nShadow, 0 );
+ const SfxPoolItem* pItem;
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) )
+ // wenn es schon einen gesetzen Set gibt, dann diesen benutzen
+ pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() );
+
+ if ( SFX_ITEM_SET ==
+ GetItemSet().GetItemState( nInner, sal_False, &pItem ) )
+ // das gesetze InfoItem wird immer ben"otigt
+ pBBSet->Put( *pItem );
+ }
+
+ //CHINA001 SvxBorderBackgroundDlg* pDlg =
+//CHINA001 new SvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() )
+ {
+ SfxItemIter aIter( *pDlg->GetOutputItemSet() );
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ if ( !IsInvalidItem( pItem ) )
+ pBBSet->Put( *pItem );
+ pItem = aIter.NextItem();
+ }
+
+ //----------------------------------------------------------------
+
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich );
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aBspWin.SetHdColor( rItem.GetColor() );
+ else
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+
+ //----------------------------------------------------------------
+
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich );
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ aBspWin.SetHdBorder( rItem );
+ else
+ aBspWin.SetFtBorder( rItem );
+ }
+
+ UpdateExample();
+ }
+ delete pDlg;
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bsp
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::UpdateExample()
+{
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ aBspWin.SetHeader( aTurnOnBox.IsChecked() );
+ aBspWin.SetHdHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetHdRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
+ }
+ else
+ {
+ aBspWin.SetFooter( aTurnOnBox.IsChecked() );
+ aBspWin.SetFtHeight( GetCoreValue( aHeightEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtDist( GetCoreValue( aDistEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtLeft( GetCoreValue( aLMEdit, SFX_MAPUNIT_TWIP ) );
+ aBspWin.SetFtRight( GetCoreValue( aRMEdit, SFX_MAPUNIT_TWIP ) );
+ }
+ aBspWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hintergrund im Beispiel setzen
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet )
+{
+ sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET );
+
+ if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, sal_False );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetHdBorder( rItem );
+ }
+ }
+ }
+
+ nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET );
+
+ if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET )
+ {
+ const SvxSetItem& rSetItem =
+ (const SvxSetItem&)rSet.Get( nWhich, sal_False );
+ const SfxItemSet& rTmpSet = rSetItem.GetItemSet();
+ const SfxBoolItem& rOn =
+ (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rOn.GetValue() )
+ {
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtColor( rItem.GetColor() );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rTmpSet.Get( nWhich );
+ aBspWin.SetFtBorder( rItem );
+ }
+ }
+ }
+ nWhich = GetWhich( SID_ATTR_BRUSH );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich );
+ aBspWin.SetColor( rItem.GetColor() );
+ const Graphic* pGrf = rItem.GetGraphic();
+
+ if ( pGrf )
+ {
+ Bitmap aBitmap = pGrf->GetBitmap();
+ aBspWin.SetBitmap( &aBitmap );
+ }
+ else
+ aBspWin.SetBitmap( NULL );
+ }
+ nWhich = GetWhich( SID_ATTR_BORDER_OUTER );
+
+ if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich );
+ aBspWin.SetBorder( rItem );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_LRSPACE );
+
+ if ( pItem )
+ {
+ // linken und rechten Rand einstellen
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)*pItem;
+
+ aBspWin.SetLeft( rLRSpace.GetLeft() );
+ aBspWin.SetRight( rLRSpace.GetRight() );
+ }
+ else
+ {
+ aBspWin.SetLeft( 0 );
+ aBspWin.SetRight( 0 );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_ULSPACE );
+
+ if ( pItem )
+ {
+ // oberen und unteren Rand einstellen
+ const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)*pItem;
+
+ aBspWin.SetTop( rULSpace.GetUpper() );
+ aBspWin.SetBottom( rULSpace.GetLower() );
+ }
+ else
+ {
+ aBspWin.SetTop( 0 );
+ aBspWin.SetBottom( 0 );
+ }
+
+ sal_uInt16 nUsage = SVX_PAGE_ALL;
+ pItem = GetItem( rSet, SID_ATTR_PAGE );
+
+ if ( pItem )
+ nUsage = ( (const SvxPageItem*)pItem )->GetPageUsage();
+
+ aBspWin.SetUsage( nUsage );
+
+ if ( SVX_PAGE_RIGHT == nUsage || SVX_PAGE_LEFT == nUsage )
+ aCntSharedBox.Disable();
+ else
+ aCntSharedBox.Enable();
+ pItem = GetItem( rSet, SID_ATTR_PAGE_SIZE );
+
+ if ( pItem )
+ {
+ // Orientation und Size aus dem PageItem
+ const SvxSizeItem& rSize = (const SvxSizeItem&)*pItem;
+ // die Groesse ist ggf. schon geswappt (Querformat)
+ aBspWin.SetSize( rSize.GetSize() );
+ }
+
+ // Kopfzeilen-Attribute auswerten
+ const SvxSetItem* pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_HEADERSET ),
+ sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rHeaderSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ long nDist = rUL.GetLower();
+
+ aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetHdDist( nDist );
+ aBspWin.SetHdLeft( rLR.GetLeft() );
+ aBspWin.SetHdRight( rLR.GetRight() );
+ aBspWin.SetHeader( sal_True );
+ }
+ else
+ pSetItem = 0;
+ }
+
+ if ( !pSetItem )
+ {
+ aBspWin.SetHeader( sal_False );
+
+ if ( SID_ATTR_PAGE_HEADERSET == nId )
+ aCntSharedBox.Disable();
+ }
+ pSetItem = 0;
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_PAGE_FOOTERSET ),
+ sal_False,
+ (const SfxPoolItem**)&pSetItem ) )
+ {
+ const SfxItemSet& rFooterSet = pSetItem->GetItemSet();
+ const SfxBoolItem& rFooterOn =
+ (const SfxBoolItem&)rFooterSet.Get( GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rFooterOn.GetValue() )
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)
+ rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
+ long nDist = rUL.GetUpper();
+
+ aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
+ aBspWin.SetFtDist( nDist );
+ aBspWin.SetFtLeft( rLR.GetLeft() );
+ aBspWin.SetFtRight( rLR.GetRight() );
+ aBspWin.SetFooter( sal_True );
+ }
+ else
+ pSetItem = 0;
+ }
+
+ if ( !pSetItem )
+ {
+ aBspWin.SetFooter( sal_False );
+
+ if ( SID_ATTR_PAGE_FOOTERSET == nId )
+ aCntSharedBox.Disable();
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT1 );
+
+ if ( pItem && pItem->ISA(SfxBoolItem) )
+ {
+ aBspWin.SetTable( sal_True );
+ aBspWin.SetHorz( ( (SfxBoolItem*)pItem )->GetValue() );
+ }
+
+ pItem = GetItem( rSet, SID_ATTR_PAGE_EXT2 );
+
+ if ( pItem && pItem->ISA(SfxBoolItem) )
+ {
+ aBspWin.SetTable( sal_True );
+ aBspWin.SetVert( ( (SfxBoolItem*)pItem )->GetValue() );
+ }
+ ResetBackground_Impl( rSet );
+ RangeHdl( 0 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxHFPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return LEAVE_PAGE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Berech
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHFPage, RangeHdl, Edit *, EMPTYARG )
+{
+ long nHHeight = aBspWin.GetHdHeight();
+ long nHDist = aBspWin.GetHdDist();
+
+ long nFHeight = aBspWin.GetFtHeight();
+ long nFDist = aBspWin.GetFtDist();
+
+ long nHeight = Max( (long)MINBODY,
+ static_cast<long>(aHeightEdit.Denormalize( aHeightEdit.GetValue( FUNIT_TWIP ) ) ) );
+ long nDist = aTurnOnBox.IsChecked() ?
+ static_cast<long>(aDistEdit.Denormalize( aDistEdit.GetValue( FUNIT_TWIP ) )) : 0;
+
+ long nMin;
+ long nMax;
+
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ nHHeight = nHeight;
+ nHDist = nDist;
+ }
+ else
+ {
+ nFHeight = nHeight;
+ nFDist = nDist;
+ }
+
+ // Aktuelle Werte der Seitenraender
+ long nBT = aBspWin.GetTop();
+ long nBB = aBspWin.GetBottom();
+ long nBL = aBspWin.GetLeft();
+ long nBR = aBspWin.GetRight();
+
+ long nH = aBspWin.GetSize().Height();
+ long nW = aBspWin.GetSize().Width();
+
+ // Grenzen
+ if ( nId == SID_ATTR_PAGE_HEADERSET )
+ {
+ // Header
+ nMin = ( nH - nBB - nBT ) / 5; // 20%
+ nMax = Max( nH - nMin - nHDist - nFDist - nFHeight - nBB - nBT,
+ nMin );
+ aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
+ nMin = ( nH - nBB - nBT ) / 5; // 20%
+ nDist = Max( nH - nMin - nHHeight - nFDist - nFHeight - nBB - nBT,
+ long(0) );
+ aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
+ }
+ else
+ {
+ // Footer
+ nMin = ( nH - nBT - nBB ) / 5; // 20%
+ nMax = Max( nH - nMin - nFDist - nHDist - nHHeight - nBT - nBB,
+ nMin );
+ aHeightEdit.SetMax( aHeightEdit.Normalize( nMax ), FUNIT_TWIP );
+ nMin = ( nH - nBT - nBB ) / 5; // 20%
+ nDist = Max( nH - nMin - nFHeight - nHDist - nHHeight - nBT - nBB,
+ long(0) );
+ aDistEdit.SetMax( aDistEdit.Normalize( nDist ), FUNIT_TWIP );
+ }
+
+ // Einzuege beschraenken
+ nMax = nW - nBL - nBR -
+ static_cast<long>(aRMEdit.Denormalize( aRMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
+ aLMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
+
+ nMax = nW - nBL - nBR -
+ static_cast<long>(aLMEdit.Denormalize( aLMEdit.GetValue( FUNIT_TWIP ) )) - MINBODY;
+ aRMEdit.SetMax( aLMEdit.Normalize( nMax ), FUNIT_TWIP );
+ return 0;
+}
+/* -----------------------------26.08.2002 12:49------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_Move(Window& rWin, sal_Int32 nDiff)
+{
+ Point aPos(rWin.GetPosPixel());
+ aPos.Y() -= nDiff;
+ rWin.SetPosPixel(aPos);
+}
+void SvxHFPage::EnableDynamicSpacing()
+{
+ aDynSpacingCB.Show();
+ //move all following controls
+ Window* aMoveWindows[] =
+ {
+ &aHeightFT,
+ &aHeightEdit,
+ &aHeightDynBtn,
+ &aBackgroundBtn,
+ 0
+ };
+ sal_Int32 nOffset = aTurnOnBox.GetPosPixel().Y() - aCntSharedBox.GetPosPixel().Y();
+ sal_Int32 nIdx = 0;
+ while(aMoveWindows[nIdx])
+ lcl_Move(*aMoveWindows[nIdx++], nOffset);
+}
+
diff --git a/svx/source/dialog/hdft.hrc b/svx/source/dialog/hdft.hrc
new file mode 100644
index 000000000000..e9c72c38b45f
--- /dev/null
+++ b/svx/source/dialog/hdft.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HDFT_HRC
+#define _SVX_HDFT_HRC
+
+// defines ---------------------------------------------------------------
+
+#define CB_TURNON 10
+#define FT_DIST 11
+#define ED_DIST 12
+#define FT_HEIGHT 13
+#define ED_HEIGHT 14
+#define CB_HEIGHT_DYN 15
+#define FT_LMARGIN 16
+#define ED_LMARGIN 17
+#define FT_RMARGIN 18
+#define ED_RMARGIN 19
+#define CB_SHARED 20
+#define FL_FRAME 21
+#define CB_DYNSPACING 22
+
+#define WN_BSP 30
+
+#define BTN_EXTRAS 40
+
+
+#endif
+
diff --git a/svx/source/dialog/hdft.src b/svx/source/dialog/hdft.src
new file mode 100644
index 000000000000..1cd402611dc8
--- /dev/null
+++ b/svx/source/dialog/hdft.src
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "hdft.hrc"
+ // pragma ----------------------------------------------------------------
+
+#define _TEXT_FT_LMARGIN \
+ Text [ en-US ] = "~Left margin" ; \
+
+#define _TEXT_FT_RMARGIN \
+ Text [ en-US ] = "R~ight margin" ; \
+
+
+ // RID_SVXPAGE_HEADER ----------------------------------------------------
+TabPage RID_SVXPAGE_HEADER
+{
+ HelpId = HID_FORMAT_HEADER ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Header" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_TURNON
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_TURNON";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Hea~der on" ;
+ };
+ CheckBox CB_SHARED
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_SHARED";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Same ~content left/right" ;
+ };
+ FixedText FT_LMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_LMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_LMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_LMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ Minimum = 0 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_RMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_RMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_RMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField ED_DIST
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_DIST";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_DYNSPACING
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_DYNSPACING";
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use d~ynamic spacing" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Height" ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_HEADER:ED_HEIGHT";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 96 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 50 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_HEIGHT_DYN
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_HEADER:CB_HEIGHT_DYN";
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~AutoFit height" ;
+ };
+ FixedLine FL_FRAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Header" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ PushButton BTN_EXTRAS
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_HEADER:BTN_EXTRAS";
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More..." ;
+ };
+};
+ // RID_SVXPAGE_FOOTER ----------------------------------------------------
+TabPage RID_SVXPAGE_FOOTER
+{
+ HelpId = HID_FORMAT_FOOTER ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Footer" ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_TURNON
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_TURNON";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~Footer on" ;
+ };
+ CheckBox CB_SHARED
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_SHARED";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "Same ~content left/right" ;
+ };
+ FixedText FT_LMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Left = TRUE ;
+ _TEXT_FT_LMARGIN
+ };
+ MetricField ED_LMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_LMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 46 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RMARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ _TEXT_FT_RMARGIN
+ Left = TRUE ;
+ };
+ MetricField ED_RMARGIN
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_RMARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 62 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Spacing" ;
+ };
+ MetricField ED_DIST
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_DIST";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_DYNSPACING
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_DYNSPACING";
+ Pos = MAP_APPFONT ( 12 , 96 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Use d~ynamic spacing" ;
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Height" ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_FOOTER:ED_HEIGHT";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 96 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 50 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_HEIGHT_DYN
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_FOOTER:CB_HEIGHT_DYN";
+ Pos = MAP_APPFONT ( 12 , 112 ) ;
+ Size = MAP_APPFONT ( 152 , 10 ) ;
+ Text [ en-US ] = "~AutoFit height" ;
+ };
+
+ FixedLine FL_FRAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Footer" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ PushButton BTN_EXTRAS
+ {
+ HelpID = "svx:PushButton:RID_SVXPAGE_FOOTER:BTN_EXTRAS";
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More..." ;
+ };
+};
+QueryBox RID_SVXQBX_DELETE_HEADFOOT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Removing headers or footers deletes the contents.\nDo you want to delete this text?" ;
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx
new file mode 100644
index 000000000000..3b15bc245779
--- /dev/null
+++ b/svx/source/dialog/hyperdlg.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/settings.hxx>
+#include <unotools/viewoptions.hxx>
+#include "svx/hyperdlg.hxx"
+#include <svx/svxdlg.hxx> //CHINA001
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+
+//########################################################################
+//# #
+//# Childwindow-Wrapper-Class #
+//# #
+//########################################################################
+
+SFX_IMPL_CHILDWINDOW(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG)
+
+// -----------------------------------------------------------------------
+
+struct MyStruct
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
+ SfxChildWinFactory* pFact;
+ sal_Bool bHideNotDelete;
+ sal_Bool bVisible;
+ sal_Bool bHideAtToggle;
+ SfxModule* pContextModule;
+ SfxWorkWindow* pWorkWin;
+};
+
+SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId ),
+
+ mpDlg( NULL )
+
+{
+ //CHINA001 pWindow = new SvxHpLinkDlg( _pParent, pBindings );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
+ mpDlg = pFact->CreateSvxHpLinkDlg( _pParent, pBindings, SID_HYPERLINK_DIALOG );
+ DBG_ASSERT(mpDlg, "Dialogdiet fail!");//CHINA001
+ pWindow = mpDlg->GetWindow();
+ ((MyStruct*)pImp)->bVisible = sal_False;
+
+ Window* pTopWindow = 0;
+ if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 &&
+ (0 != (pTopWindow = SFX_APP()->GetTopWindow())))
+ {
+ Size aParentSize( pTopWindow->GetSizePixel() );
+ Size aDlgSize ( GetSizePixel () );
+
+ if( aParentSize.Width() < pInfo->aPos.X() )
+ pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ?
+ long(0.1*aParentSize.Width()) : aParentSize.Width()-aDlgSize.Width() );
+ if( aParentSize.Height() < pInfo->aPos. Y() )
+ pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ?
+ long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() );
+
+ pWindow->SetPosPixel( pInfo->aPos );
+ }
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ SetHideNotDelete( sal_True );
+}
+
+SfxChildWinInfo SvxHlinkDlgWrapper::GetInfo() const
+{
+ return SfxChildWindow::GetInfo();
+}
+
+sal_Bool SvxHlinkDlgWrapper::QueryClose()
+{
+ return mpDlg ? mpDlg->QueryClose() : sal_True;
+}
+
diff --git a/svx/source/dialog/hyprdlg.hxx b/svx/source/dialog/hyprdlg.hxx
new file mode 100644
index 000000000000..d29a4f5969e1
--- /dev/null
+++ b/svx/source/dialog/hyprdlg.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_DLG_HYPERDLG_HXX
+#define _SVX_DLG_HYPERDLG_HXX
+
+#include <vcl/combobox.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/menu.hxx>
+#include <svtools/stdctrl.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <svl/srchcfg.hxx>
+#include <sfx2/tbxctrl.hxx>
+
+class SvxHyperlinkDlg;
+class SfxViewFrame;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class HyperCombo : public ComboBox
+{
+ SvxHyperlinkDlg *pDlg;
+ long nMaxWidth;
+ long nMinWidth;
+ long nRatio;
+
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId );
+
+ inline void SetRatio( long nR ) { nRatio = nR; }
+ inline long GetRatio() { return nRatio; }
+ long CalcResizeWidth( long nW );
+ inline long GetResizeWidth() { return (nMaxWidth - nMinWidth); }
+ void DoResize( long nW );
+};
+
+class HyperFixedText : public FixedInfo
+{
+ SvxHyperlinkDlg *pDlg;
+
+public:
+ HyperFixedText( SvxHyperlinkDlg* pDialog, const ResId& rResId );
+
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog zum Einfgen/Žndern eines Hyperlink
+ --------------------------------------------------------------------*/
+
+class SvxHyperlinkDlg : public ToolBox, public SfxControllerItem
+{
+ friend class HyperCombo;
+ friend class HyperFixedText;
+ using ToolBox::StateChanged;
+
+private:
+ SfxStatusForwarder aForwarder;
+ SfxStatusForwarder aHyperlinkDlgForward;
+ HyperCombo aNameCB;
+ HyperFixedText aUrlFT;
+ HyperCombo aUrlCB;
+
+ SvxSearchConfig aSearchConfig;
+
+ String sAddress;
+ String sExplorer;
+ String sOldName;
+ String sSearchTitle;
+ PopupMenu aLinkPopup;
+ PopupMenu *pTargetMenu;
+ sal_Bool bNoDoc;
+ sal_Bool bSend;
+ sal_Bool bHasOldName;
+ long nMaxWidth;
+ long nMinWidth;
+ long nMaxHeight;
+ sal_Bool bHtmlMode;
+
+ SfxImageManager* mpManager;
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ // DockingWindow
+ virtual void Resize();
+ virtual void Resizing(Size& rSize);
+
+ // Drag&Drop
+ sal_Bool GetDragData(sal_uInt16 nItem, sal_uIntPtr nDDFormatId, String& rBuffer);
+
+ DECL_LINK(TBClickHdl, ToolBox *);
+ DECL_LINK(TBSelectHdl, ToolBox *);
+ DECL_LINK(DropdownClick, ToolBox * );
+ DECL_LINK(LinkPopupSelectHdl, Menu *);
+ DECL_LINK(SearchPopupSelectHdl, Menu *);
+ DECL_LINK(ComboSelectHdl, ComboBox *);
+ DECL_LINK(ComboModifyHdl, ComboBox *);
+ DECL_LINK(BookmarkFoundHdl, String *);
+
+ void OpenDoc( const String& rURL, SfxViewFrame* pViewFrame );
+ void EnableLink();
+ void SendToApp(sal_uInt16 nType);
+ void AddToHistory(const String& rName, const String& rURL);
+ void TargetMenu(const String& rSelEntry, sal_Bool bExecute);
+ String GetSelTarget();
+
+ void SetImages();
+public:
+ SvxHyperlinkDlg(SfxBindings *pBindings, Window* pWindow);
+ ~SvxHyperlinkDlg();
+};
+
+
+#endif // _SVX_DLG_HYPERDLG_HXX
+
diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx
new file mode 100644
index 000000000000..dc7b438db0af
--- /dev/null
+++ b/svx/source/dialog/hyprlink.cxx
@@ -0,0 +1,999 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/cmdoptions.hxx>
+#include <svtools/inetimg.hxx>
+#include <svl/urlbmk.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/objsh.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include "svx/hlnkitem.hxx"
+#include <svx/dialogs.hrc>
+#include "hyprlink.hrc"
+#include <svx/dialmgr.hxx>
+#include "svx/hyprlink.hxx"
+#include "hyprdlg.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+
+class SearchDefaultConfigItem_Impl : public ::utl::ConfigItem
+{
+ OUString sDefaultEngine;
+public:
+ SearchDefaultConfigItem_Impl();
+ ~SearchDefaultConfigItem_Impl();
+
+ const OUString& GetDefaultSearchEngine(){ return sDefaultEngine;}
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ virtual void Commit();
+};
+
+/*-- 11.11.2003 14:20:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SearchDefaultConfigItem_Impl::SearchDefaultConfigItem_Impl() :
+ ConfigItem(OUString::createFromAscii("Inet/DefaultSearchEngine"))
+{
+ uno::Sequence<OUString> aNames(1);
+ aNames.getArray()[0] = OUString::createFromAscii("Name");
+ uno::Sequence< uno::Any > aValues = GetProperties(aNames);
+ aValues.getConstArray()[0] >>= sDefaultEngine;
+}
+/*-- 11.11.2003 14:21:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SearchDefaultConfigItem_Impl::~SearchDefaultConfigItem_Impl()
+{
+}
+
+void SearchDefaultConfigItem_Impl::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
+void SearchDefaultConfigItem_Impl::Commit()
+{
+}
+
+/*************************************************************************
+|*
+|* Dialog zum Einf"ugen/"Andern eines Hyperlink
+|*
+\************************************************************************/
+
+SvxHyperlinkDlg::SvxHyperlinkDlg( SfxBindings *_pBindings, Window* pParent) :
+
+ ToolBox ( pParent, SVX_RES( RID_SVXDLG_HYPERLINK ) ),
+ SfxControllerItem ( SID_HYPERLINK_SETLINK, *_pBindings ),
+
+ aForwarder ( SID_HYPERLINK_GETLINK, *this ),
+ aHyperlinkDlgForward( SID_HYPERLINK_DIALOG , *this),
+
+ aNameCB ( this, SVX_RES( CB_NAME ) ),
+ aUrlFT ( this, SVX_RES( FT_URL ) ),
+ aUrlCB ( this, SVX_RES( CB_URL ) ),
+ aSearchConfig (sal_True),
+ sAddress ( SVX_RES( STR_ADDRESS ) ),
+ sExplorer ( SVX_RES( STR_EXPLORER ) ),
+ sSearchTitle ( SVX_RES( STR_BOOKMARK_SEARCH ) ),
+ aLinkPopup ( SVX_RES( RID_SVXMN_HYPERLINK ) ),
+ pTargetMenu ( NULL ),
+
+ bNoDoc ( sal_True ),
+ bSend ( sal_False ),
+ bHasOldName ( sal_False ),
+ bHtmlMode ( sal_False )
+
+{
+ FreeResource();
+
+ mpManager = SfxImageManager::GetImageManager( 0 );
+ mpManager->RegisterToolBox( this );
+
+ SetImages();
+
+ // save initial size
+ nMaxWidth = GetSizePixel().Width();
+ nMaxHeight = GetSizePixel().Height();
+
+
+ InsertSeparator( 0 );
+ InsertWindow( CB_URL, &aUrlCB, 0, 0 );
+ // we need an item text for accessibility
+ String sItemText = aUrlCB.GetText();
+ if ( sItemText.Len() == 0 )
+ sItemText = aUrlCB.GetQuickHelpText();
+ if ( sItemText.Len() > 0 )
+ {
+ SetItemText( CB_URL, sItemText );
+ sItemText.Erase();
+ }
+ InsertWindow( FT_URL, &aUrlFT, 0, 0 );
+ InsertSeparator( 0 );
+ InsertWindow( CB_NAME, &aNameCB, 0, 0 );
+ sItemText = aNameCB.GetText();
+ if ( sItemText.Len() == 0 )
+ sItemText = aNameCB.GetQuickHelpText();
+ if ( sItemText.Len() > 0 )
+ SetItemText( CB_NAME, sItemText );
+
+ SetSizePixel(CalcWindowSizePixel()); // Groesse initialisieren
+
+ nMaxHeight = GetSizePixel().Height(); // Hoehe nochmal merken, da sie veraendert wurde
+ // SetSizePixel ruft Resize-Handler!
+
+ Show();
+ Resize();
+
+ long nUrlWidth = aUrlCB.GetResizeWidth();
+ long nNameWidth = aNameCB.GetResizeWidth();
+ long nSum = nUrlWidth + nNameWidth;
+
+ aUrlCB.SetRatio((nUrlWidth * 100L) / nSum);
+ aNameCB.SetRatio((nNameWidth * 100L) / nSum);
+
+ SetClickHdl( LINK( this, SvxHyperlinkDlg, TBClickHdl ) );
+ SetSelectHdl( LINK( this, SvxHyperlinkDlg, TBSelectHdl ) );
+ SetDropdownClickHdl( LINK( this, SvxHyperlinkDlg, DropdownClick ) );
+
+ SetItemBits( BTN_TARGET, GetItemBits( BTN_TARGET ) | TIB_DROPDOWNONLY );
+ SetItemBits( BTN_INET_SEARCH, GetItemBits( BTN_INET_SEARCH ) | TIB_DROPDOWN );
+ SetItemBits( BTN_INET_SEARCH, GetItemBits( BTN_TARGET ) | TIB_DROPDOWNONLY );
+
+ aLinkPopup.SetSelectHdl(LINK(this, SvxHyperlinkDlg, LinkPopupSelectHdl));
+
+ Link aLk = LINK(this, SvxHyperlinkDlg, ComboSelectHdl);
+ aNameCB.SetSelectHdl(aLk);
+ aUrlCB.SetSelectHdl(aLk);
+
+ aLk = LINK(this, SvxHyperlinkDlg, ComboModifyHdl);
+ aNameCB.SetModifyHdl(aLk);
+ aUrlCB.SetModifyHdl(aLk);
+
+ // Accessibility: Set the quick help text as accessible name for the
+ // drop down lists.
+ aNameCB.SetAccessibleName (aNameCB.GetQuickHelpText());
+ aUrlCB.SetAccessibleName (aUrlCB.GetQuickHelpText());
+
+ // Hide button according to config item.
+ SvtCommandOptions aCmdOpts;
+ if ( aCmdOpts.Lookup( SvtCommandOptions::CMDOPTION_DISABLED,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "InternetSearch" ) ) ) )
+ HideItem( BTN_INET_SEARCH );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkDlg::~SvxHyperlinkDlg()
+{
+ SfxImageManager::GetImageManager( 0 )->ReleaseToolBox(this);
+
+ if (pTargetMenu != NULL)
+ delete pTargetMenu;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Leiste so resizen, dass die Comboboxen automatisch mit
+ verkleinert werden
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::Resize()
+{
+ long nWidth = GetSizePixel().Width();
+
+ ToolBox::Resize();
+
+ if (nWidth) // nWidth ist manchmal 0
+ {
+ long nDeltaW = nMaxWidth - nWidth + aUrlCB.LogicToPixel(Size(3, 1)).Width() + 1;
+
+ long nNewUrlWidth = aUrlCB.CalcResizeWidth(nDeltaW);
+ long nNewNameWidth = aNameCB.CalcResizeWidth(nDeltaW);
+
+ if (nNewUrlWidth && nNewNameWidth) // Flackern reduzieren
+ {
+ SetUpdateMode(sal_False);
+
+ // Comboboxen resizen
+ aUrlCB.DoResize(nNewUrlWidth);
+ aNameCB.DoResize(nNewNameWidth);
+ RecalcItems(); // Alle Elemente neu anordnen
+
+ SetUpdateMode(sal_True);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::Resizing(Size& rSize)
+{
+ if (rSize.Height() > nMaxHeight)
+ rSize.Height() = nMaxHeight;
+
+ if (rSize.Width() > nMaxWidth)
+ rSize.Width() = nMaxWidth;
+
+ ToolBox::Resizing(rSize);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Im Dokument selektierten Hyperlink in Leiste anzeigen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( nSID == SID_HYPERLINK_DIALOG )
+ {
+ if( eState != SFX_ITEM_DISABLED)
+ {
+ EnableItem( BTN_OPENDIALOG, sal_True );
+
+ sal_Bool bItem = sal_False;
+ if ( pState && eState == SFX_ITEM_AVAILABLE )
+ bItem = ((SfxBoolItem*)pState)->GetValue();
+ SetItemState ( BTN_OPENDIALOG, bItem ? STATE_CHECK : STATE_NOCHECK );
+ }
+ else
+ {
+ SetItemState ( BTN_OPENDIALOG, STATE_NOCHECK );
+ EnableItem( BTN_OPENDIALOG, sal_False );
+ }
+ }
+
+ if (nSID == SID_HYPERLINK_SETLINK)
+ {
+ if (eState == SFX_ITEM_DISABLED)
+ bNoDoc = sal_True;
+ else
+ bNoDoc = sal_False;
+ EnableItem(BTN_TARGET, !bNoDoc);
+ EnableLink();
+ }
+
+ if (nSID == SID_HYPERLINK_GETLINK)
+ {
+ if (eState == SFX_ITEM_AVAILABLE)
+ {
+ const SvxHyperlinkItem& rHLnkItem = *((const SvxHyperlinkItem*)pState);
+
+ sal_uInt16 nNamePos = aNameCB.GetEntryPos(aNameCB.GetText());
+ sal_uInt16 nUrlPos = aUrlCB.GetEntryPos(aUrlCB.GetText());
+ sal_uInt16 nNotFound = COMBOBOX_ENTRY_NOTFOUND;
+
+ if (!bHasOldName &&
+ (nNamePos == nNotFound || nUrlPos == nNotFound))
+ {
+ sOldName = aNameCB.GetText();
+ bHasOldName = sal_True;
+ }
+ if (rHLnkItem.GetName().Len())
+ {
+ aNameCB.SetText(rHLnkItem.GetName());
+ ComboModifyHdl(&aNameCB);
+ }
+ if (rHLnkItem.GetURL().Len() || rHLnkItem.GetName().Len())
+ {
+ String sUrl = INetURLObject(rHLnkItem.GetURL()).GetURLNoPass();
+ aUrlCB.SetText(sUrl);
+ }
+ else if (aUrlCB.GetEntryCount())
+ { // Letzten Eintrag wieder selektieren
+ aNameCB.SetText(aNameCB.GetEntry(0));
+ aUrlCB.SetText(aUrlCB.GetEntry(0));
+ }
+
+ TargetMenu(rHLnkItem.GetTargetFrame(), sal_False);
+ bHtmlMode = (rHLnkItem.GetInsertMode() & HLINK_HTMLMODE) != 0;
+ }
+ else
+ return;
+
+ ComboModifyHdl(&aUrlCB);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, TBClickHdl, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ case BTN_LINK:
+ {
+ if (!bSend) // Link ins Dokument einfuegen
+ SendToApp(HLINK_DEFAULT);
+ }
+ break;
+
+ case BTN_OPENDIALOG:
+ {
+ GetBindings().GetDispatcher()->Execute( SID_HYPERLINK_DIALOG );
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, TBSelectHdl, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ // Link als Bookmark im Explorer eintragen
+ // Soll erst im Loslassen der Maus gerufen werden, daher im Select-Hdl
+ case BTN_INSERT_BOOKMARK:
+ {
+ String sName = aNameCB.GetText();
+ if ( !sName.Len() )
+ sName = aUrlCB.GetText();
+
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ SfxStringItem aName( SID_BOOKMARK_TITLE, sName );
+ SfxStringItem aURL( SID_BOOKMARK_URL,
+ URIHelper::SmartRel2Abs( INetURLObject(aBase), aUrlCB.GetText(), URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+ GetBindings().GetDispatcher()->Execute(
+ SID_CREATELINK, SFX_CALLMODE_ASYNCHRON, &aName, &aURL, 0L );
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+IMPL_LINK( SvxHyperlinkDlg, DropdownClick, ToolBox *, pBox )
+{
+ switch (pBox->GetCurItemId())
+ {
+ case BTN_LINK:
+ {
+ // Link-Popup anstossen
+ EndSelection(); // Vor dem Execute, damit Popup den Focus bekommt
+ aLinkPopup.EnableItem(MN_BUTTON, !bHtmlMode);
+ aLinkPopup.Execute( this, GetItemRect( BTN_LINK ), FLOATWIN_POPUPMODE_DOWN );
+ }
+ break;
+
+ case BTN_INET_SEARCH:
+ {
+ // Search-Engines per Popup auswaehlen
+ PopupMenu *pMenu = new PopupMenu;
+ pMenu->SetSelectHdl(LINK(this, SvxHyperlinkDlg, SearchPopupSelectHdl));
+ SearchDefaultConfigItem_Impl aDefaultEngine;
+ String sDefault(aDefaultEngine.GetDefaultSearchEngine());
+ sDefault.ToLowerAscii();
+ const bool bHasDefault = sDefault.Len() > 0;
+
+ sal_uInt16 nCount = aSearchConfig.Count();
+ String sFound;
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(i);
+ //check if it's the configured default search engine
+ String sTest(rData.sEngineName);
+ sTest.ToLowerAscii();
+ bool bIsDefaultEngine = bHasDefault && STRING_NOTFOUND != sTest.Search( sDefault );
+ //then put it at the top
+ if(i && bIsDefaultEngine)
+ {
+ pMenu->InsertItem( i + 1, rData.sEngineName, 0, 0);
+ pMenu->InsertSeparator(1);
+ }
+ else
+ {
+ if (i)
+ pMenu->InsertSeparator();
+ pMenu->InsertItem( i + 1, rData.sEngineName);
+ }
+ }
+ pBox->SetItemDown(BTN_INET_SEARCH, sal_True, sal_True);
+ pMenu->Execute( this, GetItemRect( BTN_INET_SEARCH ), FLOATWIN_POPUPMODE_DOWN );
+ pBox->SetItemDown(BTN_INET_SEARCH, sal_False, sal_True);
+ EndSelection();
+ delete pMenu;
+ }
+ break;
+
+ case BTN_TARGET:
+ {
+ // Target Frame einstellen
+ TargetMenu(GetSelTarget(), sal_True);
+ EndSelection();
+ }
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, sal_Bool bExecute)
+{
+ if (pTargetMenu && !bExecute)
+ {
+ for (sal_uInt16 i = 1; i <= pTargetMenu->GetItemCount(); i++)
+ {
+ if (pTargetMenu->GetItemText(i) == rSelEntry)
+ {
+ pTargetMenu->CheckItem(i);
+ return;
+ }
+ }
+ }
+
+ SfxViewFrame* pVwFrm = SfxViewFrame::Current();
+
+ if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen
+ {
+ TargetList aList;
+ pVwFrm->GetTopFrame().GetTargetList(aList);
+
+ sal_uInt16 nCount = (sal_uInt16)aList.Count();
+ if( nCount )
+ {
+ sal_Bool bChecked = sal_False;
+
+ if (pTargetMenu != NULL)
+ delete pTargetMenu;
+
+ pTargetMenu = new PopupMenu;
+ pTargetMenu->SetMenuFlags( pTargetMenu->GetMenuFlags() |
+ MENU_FLAG_NOAUTOMNEMONICS );
+ sal_uInt16 i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ String sEntry(*aList.GetObject(i));
+ pTargetMenu->InsertItem(i + 1, sEntry, MIB_RADIOCHECK|MIB_AUTOCHECK);
+
+ if (sEntry == rSelEntry)
+ {
+ pTargetMenu->CheckItem(i + 1);
+ bChecked = sal_True;
+ }
+ }
+ for ( i = nCount; i; i-- )
+ delete aList.GetObject( i - 1 );
+
+ if (!bChecked)
+ pTargetMenu->CheckItem(1);
+
+ if (bExecute)
+ {
+ sal_uInt16 nEntry = pTargetMenu->Execute(
+ this, GetItemRect( BTN_TARGET ), FLOATWIN_POPUPMODE_DOWN );
+ if ( nEntry )
+ pTargetMenu->CheckItem( nEntry );
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, LinkPopupSelectHdl, Menu *, pMenu )
+{
+ switch (pMenu->GetCurItemId())
+ {
+ case MN_FIELD: // URL als Hyperlink ins Dok einfuegen
+ SendToApp(HLINK_FIELD);
+ break;
+ case MN_BUTTON: // URL als Button ins Dok einfuegen
+ SendToApp(HLINK_BUTTON);
+ break;
+ }
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, SearchPopupSelectHdl, Menu *, pMenu )
+{
+ const SvxSearchEngineData& rData = aSearchConfig.GetData(pMenu->GetCurItemId() - 1);
+ String sText(aNameCB.GetText());
+ sText.EraseLeadingChars().EraseTrailingChars();
+
+ rtl::OUString sPrefix;
+ rtl::OUString sSuffix;
+ rtl::OUString sSeparator;
+ sal_Int32 nCaseMatch;
+ sal_Unicode cToken = 0;
+
+ if (sText.Search(' ') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sExactPrefix;
+ sSuffix = rData.sExactSuffix;
+ sSeparator = rData.sExactSeparator;
+ nCaseMatch = rData.nExactCaseMatch;
+ cToken = ' ';
+ }
+ else if (sText.Search('+') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sAndPrefix;
+ sSuffix = rData.sAndSuffix;
+ sSeparator = rData.sAndSeparator;
+ nCaseMatch = rData.nAndCaseMatch;
+ cToken = '+';
+ }
+ else if (sText.Search(',') != STRING_NOTFOUND)
+ {
+ sPrefix = rData.sOrPrefix;
+ sSuffix = rData.sOrSuffix;
+ sSeparator = rData.sOrSeparator;
+ nCaseMatch = rData.nOrCaseMatch;
+ cToken = ',';
+ }
+ else
+ {
+ sPrefix = rData.sExactPrefix;
+ sSuffix = rData.sExactSuffix;
+ nCaseMatch = rData.nExactCaseMatch;
+ cToken = 0;
+ }
+
+ String sURL = sPrefix;
+ xub_StrLen nTok;
+
+ if(1 == nCaseMatch)
+ sText.ToUpperAscii();
+ else if(2 == nCaseMatch)
+ sText.ToLowerAscii();
+
+ if ((nTok = sText.GetTokenCount(cToken)) > 1)
+ {
+ for (sal_uInt16 i = 0; i < nTok; i++)
+ {
+ sURL += sText.GetToken(i, cToken);
+ if(i < nTok -1)
+ sURL += (String)sSeparator;
+ }
+ sURL += (String)sSuffix;
+ }
+ else
+ {
+ sURL += sText;
+ sURL += (String)sSuffix;
+ }
+ sURL.EraseAllChars(); // remove all spaces
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if ( pViewFrame )
+ pViewFrame = pViewFrame->GetTopViewFrame();
+ OpenDoc( sURL, pViewFrame );
+
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, BookmarkFoundHdl, String *, pUrl )
+{
+ if (pUrl && pUrl->Len())
+ {
+ aUrlCB.SetText(*pUrl);
+ ComboModifyHdl(&aUrlCB);
+ }
+
+ return sal_True;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Link-Button enablen/disablen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::EnableLink()
+{
+ sal_Bool bEnable = aUrlCB.GetText().Len() != 0;
+
+ EnableItem(BTN_LINK, (!bNoDoc) & bEnable);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: URL im Dokument einfuegen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::SendToApp(sal_uInt16 nType)
+{
+ sal_Bool bIsFile = sal_False;
+ bSend = sal_True;
+ String sURL( aUrlCB.GetText() );
+
+ if ( !sURL.Len() )
+ return;
+
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ INetURLObject aObj( URIHelper::SmartRel2Abs( INetURLObject(aBase), sURL, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS ) );
+ sURL = aObj.GetMainURL( INetURLObject::NO_DECODE );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ bIsFile = sal_True;
+
+ if ( bIsFile )
+ {
+ EnterWait();
+ SfxMedium aMedium( sURL, STREAM_STD_READ, sal_True );
+ if ( aMedium.Exists( sal_False ) == sal_False )
+ {
+ LeaveWait();
+ QueryBox aBox( this, SVX_RES( RID_SVXQB_DONTEXIST ) );
+ if ( aBox.Execute() == RET_NO )
+ return;
+ }
+ else
+ LeaveWait();
+ }
+
+ SvxHyperlinkItem aItem( SID_HYPERLINK_SETLINK );
+
+ if (aNameCB.GetText().Len())
+ aItem.SetName( aNameCB.GetText() );
+ else
+ aItem.SetName( sURL );
+
+ sOldName = aNameCB.GetText();
+
+ aItem.SetURL(sURL);
+ aItem.SetInsertMode( (SvxLinkInsertMode)nType );
+ aItem.SetTargetFrame( GetSelTarget() );
+
+ GetBindings().GetDispatcher()->Execute(
+ SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
+
+ AddToHistory( aNameCB.GetText(), sURL );
+
+ if ( sURL != aUrlCB.GetText() )
+ aUrlCB.SetText( sURL );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Selektierten Target Frame Eintrag im Popup ermitteln
+ --------------------------------------------------------------------*/
+
+String SvxHyperlinkDlg::GetSelTarget()
+{
+ String sTarget;
+
+ if (pTargetMenu != NULL)
+ {
+ for (sal_uInt16 i = 1; i <= pTargetMenu->GetItemCount(); i++)
+ {
+ if (pTargetMenu->IsItemChecked(i))
+ {
+ sTarget = pTargetMenu->GetItemText(i);
+ break;
+ }
+ }
+ }
+
+ return sTarget;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: URL in History der Leiste aufnehmen
+ --------------------------------------------------------------------*/
+
+void SvxHyperlinkDlg::AddToHistory(const String& rName, const String& rURL)
+{
+ String sName(rName);
+
+ if (bHasOldName && sOldName.Len())
+ {
+ sName = sOldName;
+ bHasOldName = sal_False;
+ }
+
+ if (!sName.Len())
+ sName = rURL;
+
+ if (rURL.Len())
+ {
+ sal_uInt16 nNamePos = aNameCB.GetEntryPos(sName);
+ sal_uInt16 nUrlPos = aUrlCB.GetEntryPos(rURL);
+ sal_uInt16 nPos = COMBOBOX_ENTRY_NOTFOUND;
+
+ if (nNamePos != COMBOBOX_ENTRY_NOTFOUND)
+ nPos = nNamePos;
+ else
+ nPos = nUrlPos;
+
+ // Alten Eintrag durch neuen Eintrag ersetzen
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ aNameCB.RemoveEntry(nPos);
+ aUrlCB.RemoveEntry(nPos);
+ aNameCB.SetText(rName);
+ aUrlCB.SetText(rURL);
+ }
+
+ aNameCB.InsertEntry(sName, 0);
+ aUrlCB.InsertEntry(rURL, 0);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bookmark und Search-Button enablen/disablen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, ComboSelectHdl, ComboBox *, pCombo )
+{
+ sal_uInt16 nPos = pCombo->GetEntryPos(pCombo->GetText());
+
+ if (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ aNameCB.SetText(aNameCB.GetEntry(nPos));
+ aUrlCB.SetText(aUrlCB.GetEntry(nPos));
+
+ EnableLink();
+ EnableItem(BTN_INSERT_BOOKMARK, sal_True);
+ EnableItem(BTN_INET_SEARCH, sal_True);
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SvxHyperlinkDlg, ComboModifyHdl, ComboBox *, pCombo )
+{
+ sal_Bool bEnable = sal_True;
+
+ if (!pCombo->GetText().Len())
+ bEnable = sal_False;
+
+ if (pCombo == &aNameCB)
+ {
+ if (IsItemEnabled(BTN_INET_SEARCH) != bEnable)
+ EnableItem(BTN_INET_SEARCH, bEnable);
+ }
+
+ EnableLink();
+
+ if (aUrlCB.GetText().Len())
+ bEnable = sal_True;
+ else
+ bEnable = sal_False;
+
+ if (IsItemEnabled(BTN_INSERT_BOOKMARK) != bEnable)
+ EnableItem(BTN_INSERT_BOOKMARK, bEnable);
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------
+
+void SvxHyperlinkDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ToolBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
+ SetImages();
+}
+
+// --------------------------------------------------------------------
+
+void SvxHyperlinkDlg::SetImages()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ SetItemImage( BTN_LINK, mpManager->GetImage( BTN_LINK, bHighContrast ) );
+ SetItemImage( BTN_INSERT_BOOKMARK, mpManager->GetImage( BTN_INSERT_BOOKMARK, bHighContrast ) );
+ SetItemImage( BTN_INET_SEARCH, mpManager->GetImage( BTN_INET_SEARCH, bHighContrast ) );
+ SetItemImage( BTN_TARGET, mpManager->GetImage( BTN_TARGET, bHighContrast ) );
+ SetItemImage( BTN_OPENDIALOG, mpManager->GetImage( BTN_OPENDIALOG, bHighContrast ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Comboboxen
+ --------------------------------------------------------------------*/
+
+HyperCombo::HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId ) :
+ ComboBox( (Window *)pDialog, rResId )
+{
+ pDlg = pDialog;
+
+ nMaxWidth = GetSizePixel().Width();
+ if (this == &pDlg->aUrlCB)
+ nMinWidth = GetTextWidth(String::CreateFromAscii("http://www.stardiv.dewww"));
+ else
+ nMinWidth = GetTextWidth(String::CreateFromAscii("StarDivision GmbHwww"));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Comboboxen KeyInput
+ --------------------------------------------------------------------*/
+
+long HyperCombo::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ static sal_Bool bLocked = sal_False;
+
+ if (bLocked) // Keine weiteren RETURNs annehmen (nicht Reentrant!)
+ return nHandled;
+
+ bLocked = sal_True;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+
+ if (aKeyCode.GetCode() == KEY_RETURN)
+ {
+ pDlg->SendToApp(HLINK_DEFAULT);
+ nHandled = 1;
+ }
+ }
+ if (this == &pDlg->aNameCB)
+ pDlg->sOldName = GetText();
+
+ if (!nHandled)
+ nHandled = ComboBox::Notify( rNEvt );
+
+ bLocked = sal_False;
+
+ return nHandled;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drag&Drop vor dem Combo-Edit abfangen und weiterleiten
+ --------------------------------------------------------------------*/
+
+long HyperCombo::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ nHandled = ComboBox::PreNotify( rNEvt );
+
+ return nHandled;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long HyperCombo::CalcResizeWidth( long nW )
+{
+ long nNewWidth = Max(nMaxWidth - nW * GetRatio() / 100L, nMinWidth);
+
+ if (nNewWidth > nMaxWidth)
+ nNewWidth = nMaxWidth;
+
+ if (nNewWidth != GetSizePixel().Width())
+ return nNewWidth;
+ else
+ return 0; // Kein Resize notwendig
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void HyperCombo::DoResize( long nNewWidth )
+{
+ SetSizePixel(Size(nNewWidth, GetSizePixel().Height()));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FixedText
+ --------------------------------------------------------------------*/
+
+HyperFixedText::HyperFixedText( SvxHyperlinkDlg* pDialog, const ResId& rResId ) :
+ FixedInfo( (Window *)pDialog, rResId )
+{
+ pDlg = pDialog;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Webseite der Search-Engine mit Suchergebnissen anzeigen
+ --------------------------------------------------------------------*/
+void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame )
+{
+ SfxStringItem aName( SID_FILE_NAME, rURL );
+ SfxStringItem aReferer( SID_REFERER, String::CreateFromAscii("private:user") );
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_True );
+ SfxBoolItem aSilent( SID_SILENT, sal_True );
+ SfxBoolItem aReadOnly( SID_DOC_READONLY, sal_True );
+ SfxBoolItem aExternal( SID_BROWSE, sal_True );
+ SfxDispatcher* pDisp = SfxViewFrame::Current() ? SfxViewFrame::Current()->GetDispatcher() : NULL;
+
+ if ( pViewFrame )
+ {
+ SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL );
+ if ( pDisp )
+ pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L );
+ }
+ else if ( pDisp )
+ pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aName, &aNewView, &aSilent, &aReadOnly, &aReferer, 0L );
+}
+// class SvxHyperlinkDialogWrapper ------------------------------------------
+
+SFX_IMPL_CHILDWINDOW(SvxHyperlinkDlgWrapper, SID_HYPERLINK_INSERT)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Wrapper fuer Hyperlinkleiste
+ --------------------------------------------------------------------*/
+
+SvxHyperlinkDlgWrapper::SvxHyperlinkDlgWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* _pBindings, SfxChildWinInfo* /*pInfo*/ ) :
+
+ SfxChildWindow( _pParent, nId )
+
+{
+ pWindow = new SvxHyperlinkDlg( _pBindings, _pParent );
+ eChildAlignment = SFX_ALIGN_TOP;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxChildWinInfo SvxHyperlinkDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ return aInfo;
+}
+
diff --git a/svx/source/dialog/hyprlink.hrc b/svx/source/dialog/hyprlink.hrc
new file mode 100644
index 000000000000..add71ece3bcc
--- /dev/null
+++ b/svx/source/dialog/hyprlink.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_HYPERLINK_HRC
+#define _SVX_HYPERLINK_HRC
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#ifndef _SFXSIDS_HRC
+#include <sfx2/sfxsids.hrc>
+#endif
+
+// defines ------------------------------------------------------------------
+
+#define CB_NAME 1
+#define FT_URL 2
+#define CB_URL 3
+#define BTN_LINK SID_HLINKBAR_LINK
+#define BTN_INSERT_BOOKMARK SID_HLINKBAR_BOOKMARK
+#define BTN_INET_SEARCH SID_HLINKBAR_SEARCH
+#define TB 7
+#define MN_FIELD 8
+#define MN_BUTTON 9
+#define BTN_TARGET SID_HLINKBAR_TARGET
+#define STR_ADDRESS 11
+#define STR_EXPLORER 12
+#define STR_BOOKMARK_SEARCH 13
+
+#define BTN_OPENDIALOG SID_HYPERLINK_DIALOG
+
+
+#endif
+
diff --git a/svx/source/dialog/hyprlink.src b/svx/source/dialog/hyprlink.src
new file mode 100644
index 000000000000..c59a2f8eb52a
--- /dev/null
+++ b/svx/source/dialog/hyprlink.src
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include "hyprlink.hrc"
+#include "helpid.hrc"
+#include <svx/svxids.hrc>
+
+ // pragma -------------------------------------------------------------------
+
+ // RID_SVXDLG_HYPERLINK ------------------------------------------------------
+ToolBox RID_SVXDLG_HYPERLINK
+{
+ OutputSize = TRUE ;
+ Hide = TRUE;
+
+ // Dockable = TRUE ;
+ // Closeable = TRUE ;
+ // Moveable = TRUE ;
+ // Sizeable = TRUE ;
+ // EnableResizing = TRUE ;
+
+ SVLook = TRUE ;
+ Border = TRUE ;
+ Size = MAP_APPFONT ( 410 , 17 ) ;
+ Scroll = TRUE ;
+ HelpID = HID_OFA_HYPERLINK_DLG ;
+
+ Text [ en-US ] = "Insert Hyperlink" ;
+
+ ComboBox CB_NAME
+ {
+ HelpID = HID_OFA_HYPERLINK_NAME ;
+ Pos = MAP_APPFONT ( 2 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ QuickHelpText [ en-US ] = "URL Name" ;
+ };
+ FixedText FT_URL
+ {
+ HelpID = HID_OFA_HYPERLINK_URL_TXT ;
+ Pos = MAP_APPFONT ( 105 , 5 ) ;
+ Size = MAP_APPFONT ( 16 , 10 ) ;
+ Text [ en-US ] = "URL:" ;
+ };
+ ComboBox CB_URL
+ {
+ HelpID = HID_OFA_HYPERLINK_URL ;
+ Pos = MAP_APPFONT ( 121 , 3 ) ;
+ Size = MAP_APPFONT ( 204 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ QuickHelpText [ en-US ] = "Internet URLs" ;
+ };
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ HelpID = HID_OFA_HYPERLINK_TARGET ;
+ Identifier = BTN_TARGET ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Target Frame" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ HelpID = CMD_SID_HYPERLINK_SETLINK ;
+ Identifier = BTN_LINK ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = CMD_SID_CREATELINK ;
+ Identifier = BTN_INSERT_BOOKMARK ;
+ Disable = TRUE ;
+ Hide = TRUE;
+ Text [ en-US ] = "Link" ;
+ };
+ ToolBoxItem
+ {
+ HelpID = HID_OFA_HYPERLINK_SEARCH ;
+ Identifier = BTN_INET_SEARCH ;
+ Disable = TRUE ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Find" ;
+ };
+ };
+ String STR_ADDRESS
+ {
+ Text [ en-US ] = "Address Book" ;
+ };
+ String STR_EXPLORER
+ {
+ Text [ en-US ] = "Bookmark folder" ;
+ };
+ String STR_BOOKMARK_SEARCH
+ {
+ Text [ en-US ] = "Search in bookmarks";
+ };
+};
+ // PopupMenu -------------------------------------------------------------
+Menu RID_SVXMN_HYPERLINK
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_FIELD ;
+ Text [ en-US ] = "As Text" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_BUTTON ;
+ Text [ en-US ] = "As Button" ;
+ };
+ };
+};
+QueryBox RID_SVXQB_DONTEXIST
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "This URL does not exist.\nInsert anyway?" ;
+};
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
new file mode 100644
index 000000000000..9cd43f0f5195
--- /dev/null
+++ b/svx/source/dialog/imapdlg.cxx
@@ -0,0 +1,1055 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define _SDR_NOITEMS
+#define _SDR_NOTOUCH
+#define _SDR_NOTRANSFORM
+#define _SDR_NOOBJECTS
+#define _SDR_NOVIEWMARKER
+#define _SDR_NODRAGMETHODS
+#define _SDR_NOUNDO
+#define _SDR_NOXOUTDEV
+
+#include <stdlib.h>
+#include <tools/shl.hxx>
+#ifndef _EINF_HXX
+#include <tools/errinf.hxx>
+#endif
+#include <tools/urlobj.hxx>
+#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <svl/urihelper.hxx>
+#include <svtools/miscopt.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+
+#define _IMAPDLG_PRIVATE
+#include "svx/imapdlg.hxx"
+
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include "imapdlg.hrc"
+#include "imapwnd.hxx"
+#include "imapimp.hxx"
+#include "svx/dlgutil.hxx"
+#include <svx/svdtrans.hxx>
+#include <svx/svdopath.hxx>
+#include <vcl/svapp.hxx>
+
+#define SELF_TARGET "_self"
+#define IMAP_ALL_FILTER "<Alle>"
+#define IMAP_CERN_FILTER "MAP - CERN"
+#define IMAP_NCSA_FILTER "MAP - NCSA"
+#define IMAP_BINARY_FILTER "SIP - StarView ImageMap"
+#define IMAP_ALL_TYPE "*.*"
+#define IMAP_BINARY_TYPE "*.sip"
+#define IMAP_CERN_TYPE "*.map"
+#define IMAP_NCSA_TYPE "*.map"
+#define IMAP_BINARY_EXT "sip"
+#define IMAP_CERN_EXT "map"
+#define IMAP_NCSA_EXT "map"
+
+/******************************************************************************/
+
+SFX_IMPL_MODELESSDIALOG( SvxIMapDlgChildWindow, SID_IMAP );
+
+/******************************************************************************/
+
+inline String GetUnitString( long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep )
+{
+ String aVal = UniString::CreateFromInt64( MetricField::ConvertValue( nVal_100, 2, MAP_100TH_MM, eFieldUnit ) );
+
+ while( aVal.Len() < 3 )
+ aVal.Insert( sal_Unicode('0'), 0 );
+
+ aVal.Insert( cSep, aVal.Len() - 2 );
+ aVal += sal_Unicode(' ');
+ aVal += SdrFormatter::GetUnitStr( eFieldUnit );
+
+ return aVal;
+}
+
+/*************************************************************************
+|*
+|* ControllerItem
+|*
+\************************************************************************/
+
+SvxIMapDlgItem::SvxIMapDlgItem( sal_uInt16 _nId, SvxIMapDlg& rIMapDlg, SfxBindings& rBindings ) :
+ SfxControllerItem ( _nId, rBindings ),
+ rIMap ( rIMapDlg )
+{
+}
+
+/*************************************************************************
+|*
+|* StateChanged-Methode
+|*
+\************************************************************************/
+
+void SvxIMapDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
+ const SfxPoolItem* pItem )
+{
+ if ( ( nSID == SID_IMAP_EXEC ) && pItem )
+ {
+ const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
+
+ DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem erwartet");
+
+ // Float ggf. disablen
+ rIMap.SetExecState( !pStateItem->GetValue() );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pWindow = new SvxIMapDlg( pBindings, this, _pParent, SVX_RES( RID_SVXDLG_IMAP ) );
+ SvxIMapDlg* pDlg = (SvxIMapDlg*) pWindow;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj )
+{
+ if ( SfxViewFrame::Current() &&
+ SfxViewFrame::Current()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
+ SVXIMAPDLG()->Update( rGraphic, pImageMap, pTargetList, pEditingObj );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvxIMapDlg::SvxIMapDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SfxModelessDialog ( _pBindings, pCW, _pParent, rResId ),
+
+ aTbxIMapDlg1 ( this, SVX_RES( TBX_IMAPDLG1 ) ),
+ aFtURL ( this, SVX_RES( FT_URL ) ),
+ maURLBox ( this, SVX_RES( CBB_URL ) ),
+ aFtText ( this, SVX_RES( FT_TEXT ) ),
+ aEdtText ( this, SVX_RES( EDT_TEXT ) ),
+ maFtTarget ( this, SVX_RES( RID_SVXCTL_FT_TARGET ) ),
+ maCbbTarget ( this, SVX_RES( RID_SVXCTL_CBB_TARGET ) ),
+ aStbStatus ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
+ maImageList ( SVX_RES( IL_IMAPDLG ) ),
+ maImageListH ( SVX_RES( ILH_IMAPDLG ) ),
+ pCheckObj ( NULL ),
+ aIMapItem ( SID_IMAP_EXEC, *this, *_pBindings )
+{
+ pIMapWnd = new IMapWindow( this, SVX_RES( RID_SVXCTL_IMAP ), _pBindings->GetActiveFrame() );
+
+ ApplyImageList();
+
+ FreeResource();
+
+ pOwnData = new IMapOwnData( this );
+
+ pIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) );
+ pIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) );
+ pIMapWnd->SetGraphSizeLink( LINK( this, SvxIMapDlg, GraphSizeHdl ) );
+ pIMapWnd->SetUpdateLink( LINK( this, SvxIMapDlg, StateHdl ) );
+
+ maURLBox.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maURLBox.SetSelectHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maURLBox.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
+ aEdtText.SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) );
+ maCbbTarget.SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) );
+
+ SvtMiscOptions aMiscOptions;
+ aMiscOptions.AddListenerLink( LINK( this, SvxIMapDlg, MiscHdl ) );
+
+ aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ aTbxIMapDlg1.SetSizePixel( aTbxIMapDlg1.CalcWindowSizePixel() );
+ aTbxIMapDlg1.SetSelectHdl( LINK( this, SvxIMapDlg, TbxClickHdl ) );
+ aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
+ TbxClickHdl( &aTbxIMapDlg1 );
+
+ SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
+
+ aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
+ aStbStatus.InsertItem( 2, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm / 9999,99 cm ") ), SIB_CENTER | SIB_IN );
+ aStbStatus.InsertItem( 3, 10 + GetTextWidth( DEFINE_CONST_UNICODE( " 9999,99 cm x 9999,99 cm ") ), SIB_CENTER | SIB_IN );
+
+ aFtURL.Disable();
+ maURLBox.Disable();
+ aFtText.Disable();
+ aEdtText.Disable();
+ maFtTarget.Disable();
+ maCbbTarget.Disable();
+ pOwnData->bExecState = sal_False;
+
+ Resize();
+
+ pOwnData->aTimer.SetTimeout( 100 );
+ pOwnData->aTimer.SetTimeoutHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
+
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxIMapDlg::~SvxIMapDlg()
+{
+ // URL-Liste loeschen
+ delete pIMapWnd;
+ delete pOwnData;
+}
+
+
+/*************************************************************************
+|*
+|* Resize-Methode
+|*
+\************************************************************************/
+
+void SvxIMapDlg::Resize()
+{
+ SfxModelessDialog::Resize();
+
+ Size aMinSize( GetMinOutputSizePixel() );
+ Size aNewSize( GetOutputSizePixel() );
+
+ if ( aNewSize.Height() >= aMinSize.Height() )
+ {
+ Size _aSize( aStbStatus.GetSizePixel() );
+ Point aPoint( 0, aNewSize.Height() - _aSize.Height() );
+
+ // StatusBar positionieren
+ aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
+ aStbStatus.Show();
+
+ // EditWindow positionieren
+ _aSize.Width() = aNewSize.Width() - 18;
+ _aSize.Height() = aPoint.Y() - pIMapWnd->GetPosPixel().Y() - 6;
+ pIMapWnd->SetSizePixel( _aSize );
+
+ aLastSize = aNewSize;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Close-Methode
+|*
+\************************************************************************/
+
+sal_Bool SvxIMapDlg::Close()
+{
+ sal_Bool bRet = sal_True;
+
+ if ( aTbxIMapDlg1.IsItemEnabled( TBI_APPLY ) )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_MODIFY ) ) );
+ const long nRet = aQBox.Execute();
+
+ if( nRet == RET_YES )
+ {
+ SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_IMAP_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ else if( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+ else if( pIMapWnd->IsChanged() )
+ {
+ QueryBox aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_SAVE ) ) );
+ const long nRet = aQBox.Execute();
+
+ if( nRet == RET_YES )
+ bRet = DoSave();
+ else if( nRet == RET_CANCEL )
+ bRet = sal_False;
+ }
+
+ return( bRet ? SfxModelessDialog::Close() : sal_False );
+}
+
+
+/*************************************************************************
+|*
+|* Enabled oder disabled alle Controls
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetExecState( sal_Bool bEnable )
+{
+ pOwnData->bExecState = bEnable;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetGraphic( const Graphic& rGraphic )
+{
+ pIMapWnd->SetGraphic( rGraphic );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetImageMap( const ImageMap& rImageMap )
+{
+ pIMapWnd->SetImageMap( rImageMap );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const ImageMap& SvxIMapDlg::GetImageMap() const
+{
+ return pIMapWnd->GetImageMap();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::SetTargetList( const TargetList& rTargetList )
+{
+ TargetList aNewList( rTargetList );
+
+ pIMapWnd->SetTargetList( aNewList );
+
+ maCbbTarget.Clear();
+
+ for( String* pStr = aNewList.First(); pStr; pStr = aNewList.Next() )
+ maCbbTarget.InsertEntry( *pStr );
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const TargetList& SvxIMapDlg::GetTargetList() const
+{
+ return pIMapWnd->GetTargetList();
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::Update( const Graphic& rGraphic, const ImageMap* pImageMap,
+ const TargetList* pTargetList, void* pEditingObj )
+{
+ pOwnData->aUpdateGraphic = rGraphic;
+
+ if ( pImageMap )
+ pOwnData->aUpdateImageMap = *pImageMap;
+ else
+ pOwnData->aUpdateImageMap.ClearImageMap();
+
+ pOwnData->pUpdateEditingObject = pEditingObj;
+
+ // UpdateTargetList loeschen, da diese Methode
+ // vor dem Zuschlagen des Update-Timers noch
+ // mehrmals gerufen werden kann( #46540 )
+ for( String* pStr = pOwnData->aUpdateTargetList.First(); pStr; pStr = pOwnData->aUpdateTargetList.Next() )
+ delete pStr;
+ pOwnData->aUpdateTargetList.Clear();
+
+ // TargetListe muss kopiert werden, da sie im
+ // Besitz des Aufrufers ist und von ihm nach diesem
+ // Aufruf sofort geloescht werden kann;
+ // die kopierte Liste wird im Handler wieder geloescht
+ if( pTargetList )
+ {
+ TargetList aTargetList( *pTargetList );
+
+ for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ pOwnData->aUpdateTargetList.Insert( new String( *pStr ) );
+ }
+
+ pOwnData->aTimer.Start();
+}
+
+
+void SvxIMapDlg::KeyInput( const KeyEvent& rKEvt )
+{
+ SfxModelessDialog::KeyInput( rKEvt );
+}
+
+/*************************************************************************
+|*
+|* Click-Hdl fuer ToolBox
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, TbxClickHdl, ToolBox*, pTbx )
+{
+ sal_uInt16 nNewItemId = pTbx->GetCurItemId();
+
+ switch( pTbx->GetCurItemId() )
+ {
+ case( TBI_APPLY ):
+ {
+ URLLoseFocusHdl( NULL );
+ SfxBoolItem aBoolItem( SID_IMAP_EXEC, sal_True );
+ GetBindings().GetDispatcher()->Execute(
+ SID_IMAP_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
+ }
+ break;
+
+ case( TBI_OPEN ):
+ DoOpen();
+ break;
+
+ case( TBI_SAVEAS ):
+ DoSave();
+ break;
+
+ case( TBI_SELECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetEditMode( sal_True );
+ if( pTbx->IsKeyEvent() )
+ {
+ if((pTbx->GetKeyModifier() & KEY_MOD1) != 0)
+ pIMapWnd->SelectFirstObject();
+ else
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_RECT ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_RECT );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_CIRCLE ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_CIRC );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_POLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_POLY );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_FREEPOLY ):
+ {
+ pTbx->CheckItem( nNewItemId, sal_True );
+ pIMapWnd->SetObjKind( OBJ_FREEFILL );
+ if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) )
+ {
+ pIMapWnd->CreateDefaultObject();
+ pIMapWnd->GrabFocus();
+ }
+ }
+ break;
+
+ case( TBI_ACTIVE ):
+ {
+ URLLoseFocusHdl( NULL );
+ sal_Bool bNewState = !pTbx->IsItemChecked( TBI_ACTIVE );
+ pTbx->CheckItem( TBI_ACTIVE, bNewState );
+ pIMapWnd->SetCurrentObjState( !bNewState );
+ }
+ break;
+
+ case( TBI_MACRO ):
+ pIMapWnd->DoMacroAssign();
+ break;
+
+ case( TBI_PROPERTY ):
+ pIMapWnd->DoPropertyDialog();
+ break;
+
+ case( TBI_POLYEDIT ):
+ pIMapWnd->SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
+ if( pTbx->IsKeyEvent() && pTbx->IsItemChecked( TBI_POLYEDIT ) )
+ pIMapWnd->StartPolyEdit();
+ break;
+
+ case( TBI_POLYMOVE ):
+ pIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE );
+ break;
+
+ case( TBI_POLYINSERT ):
+ pIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT );
+ break;
+
+ case( TBI_POLYDELETE ):
+ pIMapWnd->GetSdrView()->DeleteMarkedPoints();
+ break;
+
+ case( TBI_UNDO ):
+ {
+ URLLoseFocusHdl( NULL );
+ pIMapWnd->GetSdrModel()->Undo();
+ }
+ break;
+
+ case( TBI_REDO ):
+ {
+ URLLoseFocusHdl( NULL );
+ pIMapWnd->GetSdrModel()->Redo();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void SvxIMapDlg::DoOpen()
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+
+ ImageMap aLoadIMap;
+ const String aFilter( DEFINE_CONST_UNICODE( IMAP_ALL_FILTER ) );
+
+ aDlg.AddFilter( aFilter, DEFINE_CONST_UNICODE( IMAP_ALL_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ), DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ), DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
+ aDlg.AddFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ), DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
+
+ aDlg.SetCurrentFilter( aFilter );
+ aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ INetURLObject aURL( aDlg.GetPath() );
+ DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
+ SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+
+ if( pIStm )
+ {
+ aLoadIMap.Read( *pIStm, IMAP_FORMAT_DETECT, String() );
+
+ if( pIStm->GetError() )
+ {
+ SfxErrorContext eEC(ERRCODE_SFX_GENERAL,this);
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ }
+ else
+ pIMapWnd->SetImageMap( aLoadIMap );
+
+ delete pIStm;
+ }
+
+ pIMapWnd->Invalidate();
+ }
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool SvxIMapDlg::DoSave()
+{
+ ::sfx2::FileDialogHelper aDlg(
+ com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
+
+ const String aBinFilter( DEFINE_CONST_UNICODE( IMAP_BINARY_FILTER ) );
+ const String aCERNFilter( DEFINE_CONST_UNICODE( IMAP_CERN_FILTER ) );
+ const String aNCSAFilter( DEFINE_CONST_UNICODE( IMAP_NCSA_FILTER ) );
+ SdrModel* pModel = pIMapWnd->GetSdrModel();
+ const sal_Bool bChanged = pModel->IsChanged();
+ sal_Bool bRet = false;
+
+ aDlg.AddFilter( aCERNFilter, DEFINE_CONST_UNICODE( IMAP_CERN_TYPE ) );
+ aDlg.AddFilter( aNCSAFilter, DEFINE_CONST_UNICODE( IMAP_NCSA_TYPE ) );
+ aDlg.AddFilter( aBinFilter, DEFINE_CONST_UNICODE( IMAP_BINARY_TYPE ) );
+
+ aDlg.SetCurrentFilter( aCERNFilter );
+ aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
+
+ if( aDlg.Execute() == ERRCODE_NONE )
+ {
+ const String aFilter( aDlg.GetCurrentFilter() );
+ String aExt;
+ sal_uIntPtr nFormat;
+
+ if ( aFilter == aBinFilter )
+ {
+ nFormat = IMAP_FORMAT_BIN;
+ aExt = DEFINE_CONST_UNICODE( IMAP_BINARY_EXT );
+ }
+ else if ( aFilter == aCERNFilter )
+ {
+ nFormat = IMAP_FORMAT_CERN;
+ aExt = DEFINE_CONST_UNICODE( IMAP_CERN_EXT );
+ }
+ else if ( aFilter == aNCSAFilter )
+ {
+ nFormat = IMAP_FORMAT_NCSA;
+ aExt = DEFINE_CONST_UNICODE( IMAP_NCSA_EXT );
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ INetURLObject aURL( aDlg.GetPath() );
+
+ if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ {
+ DBG_ERROR( "invalid URL" );
+ }
+ else
+ {
+ if( !aURL.getExtension().getLength() )
+ aURL.setExtension( aExt );
+
+ SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC );
+ if( pOStm )
+ {
+ pIMapWnd->GetImageMap().Write( *pOStm, nFormat, String() );
+
+ if( pOStm->GetError() )
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+
+ delete pOStm;
+ pModel->SetChanged( bChanged );
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const NotifyInfo& rInfo = pWnd->GetInfo();
+
+ if ( rInfo.bNewObj )
+ {
+ if( rInfo.aMarkURL.Len() && ( maURLBox.GetEntryPos( rInfo.aMarkURL ) == LISTBOX_ENTRY_NOTFOUND ) )
+ maURLBox.InsertEntry( rInfo.aMarkURL );
+
+ maURLBox.SetText( rInfo.aMarkURL );
+ aEdtText.SetText( rInfo.aMarkAltText );
+
+ if ( !rInfo.aMarkTarget.Len() )
+ maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
+ else
+ maCbbTarget.SetText( rInfo.aMarkTarget );
+ }
+
+ if ( !rInfo.bOneMarked )
+ {
+ aTbxIMapDlg1.CheckItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_False );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_False );
+ aStbStatus.SetItemText( 1, aStr );
+
+ aFtURL.Disable();
+ maURLBox.Disable();
+ aFtText.Disable();
+ aEdtText.Disable();
+ maFtTarget.Disable();
+ maCbbTarget.Disable();
+
+ maURLBox.SetText( String() );
+ aEdtText.SetText( String() );
+ }
+ else
+ {
+ aTbxIMapDlg1.EnableItem( TBI_ACTIVE, sal_True );
+ aTbxIMapDlg1.CheckItem( TBI_ACTIVE, !rInfo.bActivated );
+ aTbxIMapDlg1.EnableItem( TBI_MACRO, sal_True );
+ aTbxIMapDlg1.EnableItem( TBI_PROPERTY, sal_True );
+
+ aFtURL.Enable();
+ maURLBox.Enable();
+ aFtText.Enable();
+ aEdtText.Enable();
+ maFtTarget.Enable();
+ maCbbTarget.Enable();
+
+ aStbStatus.SetItemText( 1, rInfo.aMarkURL );
+
+ if ( maURLBox.GetText() != rInfo.aMarkURL )
+ maURLBox.SetText( rInfo.aMarkURL );
+
+ if ( aEdtText.GetText() != rInfo.aMarkAltText )
+ aEdtText.SetText( rInfo.aMarkAltText );
+
+ if ( !rInfo.aMarkTarget.Len() )
+ maCbbTarget.SetText( DEFINE_CONST_UNICODE( SELF_TARGET ) );
+ else
+ maCbbTarget.SetText( rInfo.aMarkTarget );
+ }
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Point& rMousePos = pWnd->GetMousePos();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
+ aStr.Append( DEFINE_CONST_UNICODE( " / " ) );
+ aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 2, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
+{
+ String aStr;
+ const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
+ const Size& rSize = pWnd->GetGraphicSize();
+ LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep().GetChar(0);
+
+ aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
+ aStr.Append( DEFINE_CONST_UNICODE( " x " ) );
+ aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
+
+ aStbStatus.SetItemText( 3, aStr );
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, URLModifyHdl, void*, EMPTYARG )
+{
+ NotifyInfo aNewInfo;
+
+ aNewInfo.aMarkURL = maURLBox.GetText();
+ aNewInfo.aMarkAltText = aEdtText.GetText();
+ aNewInfo.aMarkTarget = maCbbTarget.GetText();
+
+ pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, URLLoseFocusHdl, void*, EMPTYARG )
+{
+ NotifyInfo aNewInfo;
+ const String aURLText( maURLBox.GetText() );
+ const String aTargetText( maCbbTarget.GetText() );
+
+ if ( aURLText.Len() )
+ {
+ String aBase = GetBindings().GetDispatcher()->GetFrame()->GetObjectShell()->GetMedium()->GetBaseURL();
+ aNewInfo.aMarkURL = ::URIHelper::SmartRel2Abs( INetURLObject(aBase), aURLText, URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+ else
+ aNewInfo.aMarkURL = aURLText;
+
+ aNewInfo.aMarkAltText = aEdtText.GetText();
+
+ if ( !aTargetText.Len() )
+ aNewInfo.aMarkTarget = DEFINE_CONST_UNICODE( SELF_TARGET );
+ else
+ aNewInfo.aMarkTarget = aTargetText;
+
+ pIMapWnd->ReplaceActualIMapInfo( aNewInfo );
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, UpdateHdl, Timer*, EMPTYARG )
+{
+ pOwnData->aTimer.Stop();
+
+ if ( pOwnData->pUpdateEditingObject != pCheckObj )
+ {
+ if ( pIMapWnd->IsChanged() &&
+ ( QueryBox( this, WB_YES_NO | WB_DEF_YES,
+ String( SVX_RES( STR_IMAPDLG_SAVE ) ) ).Execute() == RET_YES ) )
+ {
+ DoSave();
+ }
+
+ SetGraphic( pOwnData->aUpdateGraphic );
+ SetImageMap( pOwnData->aUpdateImageMap );
+ SetTargetList( pOwnData->aUpdateTargetList );
+ SetEditingObject( pOwnData->pUpdateEditingObject );
+
+ // Nach Wechsel => default Selektion
+ aTbxIMapDlg1.CheckItem( TBI_SELECT, sal_True );
+ pIMapWnd->SetEditMode( sal_True );
+ }
+
+ // die in der Update-Methode kopierte Liste wieder loeschen
+ for( String* pStr = pOwnData->aUpdateTargetList.First(); pStr; pStr = pOwnData->aUpdateTargetList.Next() )
+ delete pStr;
+
+ pOwnData->aUpdateTargetList.Clear();
+
+ GetBindings().Invalidate( SID_IMAP_EXEC );
+
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, StateHdl, IMapWindow*, pWnd )
+{
+ const SdrObject* pObj = pWnd->GetSelectedSdrObject();
+ const SdrModel* pModel = pWnd->GetSdrModel();
+ const SdrView* pView = pWnd->GetSdrView();
+ const sal_Bool bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
+ const sal_Bool bDrawEnabled = !( bPolyEdit && aTbxIMapDlg1.IsItemChecked( TBI_POLYEDIT ) );
+
+ aTbxIMapDlg1.EnableItem( TBI_APPLY, pOwnData->bExecState && pWnd->IsChanged() );
+
+ aTbxIMapDlg1.EnableItem( TBI_SELECT, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_RECT, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_CIRCLE, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLY, bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_FREEPOLY, bDrawEnabled );
+
+ // BezierEditor-Stati
+ aTbxIMapDlg1.EnableItem( TBI_POLYEDIT, bPolyEdit );
+ aTbxIMapDlg1.EnableItem( TBI_POLYMOVE, !bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLYINSERT, !bDrawEnabled );
+ aTbxIMapDlg1.EnableItem( TBI_POLYDELETE, !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
+
+ // Undo/Redo
+ aTbxIMapDlg1.EnableItem( TBI_UNDO, pModel->GetUndoActionCount() > 0 );
+ aTbxIMapDlg1.EnableItem( TBI_REDO, pModel->GetRedoActionCount() > 0 );
+
+ if ( bPolyEdit )
+ {
+ sal_uInt16 nId = 0;
+
+ switch( pWnd->GetPolyEditMode() )
+ {
+ case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
+ case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
+
+ default:
+ break;
+ }
+
+ aTbxIMapDlg1.CheckItem( nId, sal_True );
+ }
+ else
+ {
+ aTbxIMapDlg1.CheckItem( TBI_POLYEDIT, sal_False );
+ aTbxIMapDlg1.CheckItem( TBI_POLYMOVE, sal_True );
+ aTbxIMapDlg1.CheckItem( TBI_POLYINSERT, sal_False );
+ pWnd->SetPolyEditMode( 0 );
+ }
+
+ return 0L;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( SvxIMapDlg, MiscHdl, void*, EMPTYARG )
+{
+ SvtMiscOptions aMiscOptions;
+ aTbxIMapDlg1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+
+ return 0L;
+}
+
+void SvxIMapDlg::ApplyImageList()
+{
+ bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ ImageList& rImgLst = bHighContrast ? maImageListH : maImageList;
+
+ aTbxIMapDlg1.SetImageList( rImgLst );
+}
+
+void SvxIMapDlg::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModelessDialog::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+}
diff --git a/svx/source/dialog/imapdlg.hrc b/svx/source/dialog/imapdlg.hrc
new file mode 100644
index 000000000000..4a6d322699b5
--- /dev/null
+++ b/svx/source/dialog/imapdlg.hrc
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+
+// ImapDlg-Dialoge
+#define RID_SVX_IMAPDLG_START RID_SVX_IMAP_START
+
+
+/******************************************************************************/
+
+
+#define RID_SVXDLG_IMAP (RID_SVX_IMAPDLG_START)
+#define RID_SVXCTL_IMAP (RID_SVX_IMAPDLG_START + 7)
+
+#define TBX_IMAPDLG1 1
+#define TBI_APPLY 1
+#define TBI_OPEN 2
+#define TBI_SAVEAS 3
+
+#define TBI_SELECT 4
+#define TBI_RECT 5
+#define TBI_CIRCLE 6
+#define TBI_POLY 7
+#define TBI_FREEPOLY 8
+
+#define TBI_ACTIVE 16
+#define TBI_COLOR 17
+#define TBI_MACRO 18
+#define TBI_PROPERTY 19
+
+#define TBI_POLYEDIT 30
+#define TBI_POLYMOVE 31
+#define TBI_POLYINSERT 32
+#define TBI_POLYDELETE 33
+
+#define TBI_UNDO 40
+#define TBI_REDO 41
+
+#define FT_URL 1
+#define FT_TEXT 2
+#define FT_TARG 3
+#define CBB_URL 1
+#define EDT_TEXT 1
+#define LB_TARG 1
+
+#define STB_STATUS 1
+
+#define IL_IMAPDLG 1024
+#define ILH_IMAPDLG 1025
+
+/******************************************************************************/
+
+
+#define RID_SVXMN_IMAP (RID_SVX_IMAPDLG_START + 1)
+
+#define MN_URL 1
+#define MN_POSITION 2
+#define MN_FRAME_TO_TOP 3
+#define MN_MOREFRONT 4
+#define MN_MOREBACK 5
+#define MN_FRAME_TO_BOTTOM 6
+#define MN_MARK_ALL 7
+#define MN_DELETE1 8
+#define MN_ACTIVATE 9
+#define MN_MACRO 10
+
+/******************************************************************************/
+
+
+#define RID_SVXCTL_FT_TARGET (RID_SVX_IMAPDLG_START + 3)
+#define RID_SVXCTL_CBB_TARGET (RID_SVX_IMAPDLG_START + 4)
+
+
+/******************************************************************************/
+
+
+#define STR_IMAPDLG_SAVE (RID_SVX_IMAPDLG_START + 5)
+#define STR_IMAPDLG_MODIFY (RID_SVX_IMAPDLG_START + 6)
+
+
+/******************************************************************************/
diff --git a/svx/source/dialog/imapdlg.src b/svx/source/dialog/imapdlg.src
new file mode 100644
index 000000000000..d691f5443b5a
--- /dev/null
+++ b/svx/source/dialog/imapdlg.src
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "helpid.hrc"
+#include "imapdlg.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_IMAP ----------------------------------------------------
+ModelessDialog RID_SVXDLG_IMAP
+{
+ HelpID = "svx:ModelessDialog:RID_SVXDLG_IMAP";
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 270 , 213 ) ;
+ Sizeable = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ ToolBox TBX_IMAPDLG1
+ {
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ HelpId = HID_IMAPDLG_TOOLBOX ;
+
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBI_APPLY ;
+ HelpId = HID_IMAPDLG_APPLY ;
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_OPEN ;
+ HelpId = HID_IMAPDLG_OPEN ;
+ Text [ en-US ] = "Open..." ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SAVEAS ;
+ HelpId = HID_IMAPDLG_SAVEAS ;
+
+ Text [ en-US ] = "Save..." ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_SELECT ;
+ HelpId = HID_IMAPDLG_SELECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Select" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_RECT ;
+ HelpId = HID_IMAPDLG_RECT ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Rectangle" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_CIRCLE ;
+ HelpId = HID_IMAPDLG_CIRCLE ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Ellipse" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLY ;
+ HelpId = HID_IMAPDLG_POLY ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ Text [ en-US ] = "Polygon" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_FREEPOLY ;
+ HelpId = HID_IMAPDLG_FREEPOLY ;
+ Text [ en-US ] = "Freeform Polygon" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYEDIT ;
+ HelpId = HID_IMAPDLG_POLYEDIT ;
+ Text [ en-US ] = "Edit Points" ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYMOVE ;
+ HelpId = HID_IMAPDLG_POLYMOVE ;
+ Text [ en-US ] = "Move Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYINSERT ;
+ HelpId = HID_IMAPDLG_POLYINSERT ;
+ Text [ en-US ] = "Insert Points" ;
+ RadioCheck = TRUE ;
+ AutoCheck = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_POLYDELETE ;
+ HelpId = HID_IMAPDLG_POLYDELETE ;
+ Text [ en-US ] = "Delete Points" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_UNDO ;
+ HelpId = HID_IMAPDLG_UNDO ;
+ Text [ en-US ] = "Undo " ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_REDO ;
+ HelpId = HID_IMAPDLG_REDO ;
+ Text [ en-US ] = "Redo" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_ACTIVE ;
+ HelpId = HID_IMAPDLG_ACTIVE ;
+ Text [ en-US ] = "Active" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_MACRO ;
+ HelpId = HID_IMAPDLG_MACRO ;
+ Text [ en-US ] = "Macro..." ;
+ };
+ ToolBoxItem
+ {
+ Identifier = TBI_PROPERTY ;
+ HelpId = HID_IMAPDLG_PROPERTY ;
+ Text [ en-US ] = "Properties..." ;
+ };
+ };
+ };
+
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 25 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Text [ en-US ] = "Address:" ;
+ };
+ ComboBox CBB_URL
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_IMAP:CBB_URL";
+ Pos = MAP_APPFONT ( 39 , 23 ) ;
+ Size = MAP_APPFONT ( 225 , 69 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoSize = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Text [ en-US ] = "Text:" ;
+ };
+ Edit EDT_TEXT
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_IMAP:EDT_TEXT";
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 39 , 41 ) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ Text [ en-US ] = "ImageMap Editor" ;
+
+ FixedText RID_SVXCTL_FT_TARGET
+ {
+ Pos = MAP_APPFONT ( 188 , 43 ) ;
+ Size = MAP_APPFONT ( 22 , 12 ) ;
+ Text [ en-US ] = "Frame:" ;
+ };
+ // nur temporaer
+ ComboBox RID_SVXCTL_CBB_TARGET
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_IMAP:RID_SVXCTL_CBB_TARGET";
+ Border = TRUE ;
+ Sort = TRUE ;
+ Pos = MAP_APPFONT ( 213 , 41 ) ;
+ Size = MAP_APPFONT ( 51 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ HScroll = TRUE ;
+ };
+
+
+#define IMAPDLG_IDLIST \
+ IdList = \
+ { \
+ TBI_APPLY ; \
+ TBI_OPEN ; \
+ TBI_SAVEAS ; \
+ TBI_SELECT ; \
+ TBI_RECT ; \
+ TBI_CIRCLE ; \
+ TBI_POLY ; \
+ TBI_FREEPOLY ; \
+ TBI_POLYEDIT ; \
+ TBI_POLYMOVE ; \
+ TBI_POLYINSERT ; \
+ TBI_POLYDELETE ; \
+ TBI_UNDO ; \
+ TBI_REDO ; \
+ TBI_ACTIVE ; \
+ TBI_MACRO ; \
+ TBI_PROPERTY ; \
+ }; \
+ IdCount = { 17 ; };
+
+ ImageList IL_IMAPDLG
+ {
+ Prefix = "id";
+ MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+ IMAPDLG_IDLIST
+ };
+ ImageList ILH_IMAPDLG
+ {
+ Prefix = "idh";
+ MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+ IMAPDLG_IDLIST
+ };
+};
+Control RID_SVXCTL_IMAP
+{
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ HelpId = HID_IMAPDLG_GRAPHWND ;
+};
+
+/******************************************************************************/
+Menu RID_SVXMN_IMAP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_URL ;
+ Text [ en-US ] = "Description..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MACRO ;
+ Text [ en-US ] = "~Macro..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_ACTIVATE ;
+ Text [ en-US ] = "Active" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_POSITION ;
+ Text [ en-US ] = "Arrange" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_FRAME_TO_TOP ;
+ Text [ en-US ] = "Bring to Front" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MOREFRONT ;
+ Text [ en-US ] = "Bring ~Forward" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MOREBACK ;
+ Text [ en-US ] = "Send Back~ward" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FRAME_TO_BOTTOM ;
+ Text [ en-US ] = "~Send to Back" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_MARK_ALL ;
+ Text [ en-US ] = "Select ~All" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_DELETE1 ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ };
+};
+
+/******************************************************************************/
+
+String STR_IMAPDLG_SAVE
+{
+ Text [ en-US ] = "The ImageMap has been modified.\nDo you want to save the changes?";
+};
+
+String STR_IMAPDLG_MODIFY
+{
+ Text [ en-US ] = "The ImageMap has been modified.\nDo you want to save the changes?" ;
+};
diff --git a/svx/source/dialog/imapimp.hxx b/svx/source/dialog/imapimp.hxx
new file mode 100644
index 000000000000..fd496a609f90
--- /dev/null
+++ b/svx/source/dialog/imapimp.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _IMAPIMP_HXX_
+#define _IMAPIMP_HXX_
+
+// ---------------
+// - IMapOwnData -
+// ---------------
+
+class IMapOwnData
+{
+private:
+
+ SvxIMapDlg* pIMap;
+
+public:
+
+ Timer aTimer;
+ Timer aTbxTimer;
+ Graphic aUpdateGraphic;
+ ImageMap aUpdateImageMap;
+ TargetList aUpdateTargetList;
+ void* pUpdateEditingObject;
+ sal_Bool bExecState;
+
+ IMapOwnData( SvxIMapDlg* pIMapDlg ) : pIMap ( pIMapDlg ) {}
+};
+
+
+#endif // _IMAPIMP_HXX
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
new file mode 100644
index 000000000000..ff152a152d51
--- /dev/null
+++ b/svx/source/dialog/imapwnd.cxx
@@ -0,0 +1,1069 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
+#include <sfx2/sfxsids.hrc> // SID_ATTR_MACROITEM
+#define _ANIMATION
+#include <svtools/imaprect.hxx>
+#include <svtools/imapcirc.hxx>
+#include <svtools/imappoly.hxx>
+#include <svl/urlbmk.hxx>
+
+#include <svx/xoutbmp.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxids.hrc>
+#include <imapdlg.hrc>
+#include <imapwnd.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xfltrit.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/xfillit.hxx>
+#include <svx/xlineit.hxx>
+#include <sfx2/evntconf.hxx>
+
+#include <sot/formats.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using ::com::sun::star::frame::XFrame;
+using ::com::sun::star::uno::Reference;
+
+#define TRANSCOL Color( COL_WHITE )
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapWindow::IMapWindow( Window* pParent, const ResId& rResId, const Reference< XFrame >& rxDocumentFrame ) :
+ GraphCtrl( pParent, rResId ),
+ DropTargetHelper( this ),
+ mxDocumentFrame( rxDocumentFrame )
+{
+ SetWinStyle( WB_SDRMODE );
+
+ pItemInfo = new SfxItemInfo[ 1 ];
+ memset( pItemInfo, 0, sizeof( SfxItemInfo ) );
+ pIMapPool = new SfxItemPool( String::CreateFromAscii( "IMapItemPool" ),
+ SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, pItemInfo );
+ pIMapPool->FreezeIdRanges();
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapWindow::~IMapWindow()
+{
+ // Liste loeschen
+ for( String* pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ delete pStr;
+
+ SfxItemPool::Free(pIMapPool);
+ delete[] pItemInfo;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetImageMap( const ImageMap& rImageMap )
+{
+ ReplaceImageMap( rImageMap, sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::ReplaceImageMap( const ImageMap& rImageMap, sal_Bool /*bScaleToGraphic*/ )
+{
+ SdrPage* pPage = 0;
+ aIMap = rImageMap;
+
+ if(GetSdrModel())
+ {
+ // try to access page
+ pPage = GetSdrModel()->GetPage(0L);
+ }
+
+ if(pPage)
+ {
+ // clear all draw objects
+ pPage->Clear();
+ }
+
+ if(GetSdrView())
+ {
+ // #i63762# reset selection at view
+ GetSdrView()->UnmarkAllObj();
+ }
+
+ // create new drawing objects
+ const sal_uInt16 nCount(rImageMap.GetIMapObjectCount());
+
+ for ( sal_uInt16 i(nCount); i > 0; i-- )
+ {
+ SdrObject* pNewObj = CreateObj( rImageMap.GetIMapObject( i - 1 ) );
+
+ if ( pNewObj )
+ {
+ pPage->InsertObject( pNewObj );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Bool IMapWindow::ReplaceActualIMapInfo( const NotifyInfo& rNewInfo )
+{
+ const SdrObject* pSdrObj = GetSelectedSdrObject();
+ IMapObject* pIMapObj;
+ sal_Bool bRet = sal_False;
+
+ if ( pSdrObj && ( ( pIMapObj = GetIMapObj( pSdrObj ) ) != NULL ) )
+ {
+ pIMapObj->SetURL( rNewInfo.aMarkURL );
+ pIMapObj->SetAltText( rNewInfo.aMarkAltText );
+ pIMapObj->SetTarget( rNewInfo.aMarkTarget );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_False );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+const ImageMap& IMapWindow::GetImageMap()
+{
+ if ( pModel->IsChanged() )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+
+ if ( pPage )
+ {
+ const long nCount = pPage->GetObjCount();
+
+ aIMap.ClearImageMap();
+
+ for ( long i = nCount - 1; i > -1; i-- )
+ aIMap.InsertIMapObject( *( ( (IMapUserData*) pPage->GetObj( i )->GetUserData( 0 ) )->GetObject() ) );
+ }
+
+ pModel->SetChanged( sal_False );
+ }
+
+ return aIMap;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetTargetList( TargetList& rTargetList )
+{
+ String* pStr;
+
+ // alte Liste loeschen
+ for( pStr = aTargetList.First(); pStr; pStr = aTargetList.Next() )
+ delete pStr;
+
+ aTargetList.Clear();
+
+ // mit uebergebener Liste fuellen
+ for( pStr = rTargetList.First(); pStr; pStr = rTargetList.Next() )
+ aTargetList.Insert( new String( *pStr ) );
+
+ pModel->SetChanged( sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
+{
+ Point aPoint;
+ Rectangle aClipRect( aPoint, GetGraphicSize() );
+ SdrObject* pSdrObj = NULL;
+ IMapObjectPtr pCloneIMapObj;
+
+ switch( pIMapObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ {
+ IMapRectangleObject* pIMapRectObj = (IMapRectangleObject*) pIMapObj;
+ Rectangle aDrawRect( pIMapRectObj->GetRectangle( sal_False ) );
+
+ // auf Zeichenflaeche clippen
+ aDrawRect.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrRectObj( aDrawRect );
+ pCloneIMapObj.reset((IMapObject*) new IMapRectangleObject( *pIMapRectObj ));
+ }
+ break;
+
+ case( IMAP_OBJ_CIRCLE ):
+ {
+ IMapCircleObject* pIMapCircleObj = (IMapCircleObject*) pIMapObj;
+ const Point aCenter( pIMapCircleObj->GetCenter( sal_False ) );
+ const long nRadius = pIMapCircleObj->GetRadius( sal_False );
+ const Point aOffset( nRadius, nRadius );
+ Rectangle aCircle( aCenter - aOffset, aCenter + aOffset );
+
+ // auf Zeichenflaeche begrenzen
+ aCircle.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aCircle, 0, 36000 );
+ pCloneIMapObj.reset((IMapObject*) new IMapCircleObject( *pIMapCircleObj ));
+ }
+ break;
+
+ case( IMAP_OBJ_POLYGON ):
+ {
+ IMapPolygonObject* pIMapPolyObj = (IMapPolygonObject*) pIMapObj;
+
+ // Falls wir eigentlich eine Ellipse sind,
+ // erzeugen wir auch wieder eine Ellipse
+ if ( pIMapPolyObj->HasExtraEllipse() )
+ {
+ Rectangle aDrawRect( pIMapPolyObj->GetExtraEllipse() );
+
+ // auf Zeichenflaeche clippen
+ aDrawRect.Intersection( aClipRect );
+
+ pSdrObj = (SdrObject*) new SdrCircObj( OBJ_CIRC, aDrawRect, 0, 36000 );
+ }
+ else
+ {
+ const Polygon& rPoly = pIMapPolyObj->GetPolygon( sal_False );
+ Polygon aDrawPoly( rPoly );
+
+ // auf Zeichenflaeche clippen
+ aDrawPoly.Clip( aClipRect );
+
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(aDrawPoly.getB2DPolygon());
+ pSdrObj = (SdrObject*)new SdrPathObj(OBJ_POLY, basegfx::B2DPolyPolygon(aPolygon));
+ }
+
+ pCloneIMapObj.reset((IMapObject*) new IMapPolygonObject( *pIMapPolyObj ));
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pSdrObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+
+ if ( !pIMapObj->IsActive() )
+ {
+ aSet.Put( XFillTransparenceItem( 100 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
+ }
+ else
+ {
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
+ }
+
+ //pSdrObj->SetItemSetAndBroadcast(aSet);
+ pSdrObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pSdrObj->InsertUserData( new IMapUserData( pCloneIMapObj ) );
+ pSdrObj->SetUserCall( GetSdrUserCall() );
+ }
+
+ return pSdrObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::InitSdrModel()
+{
+ GraphCtrl::InitSdrModel();
+
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ pView->SetAttributes( aSet );
+ pView->SetFrameDragSingles( sal_True );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SdrObjCreated( const SdrObject& rObj )
+{
+ switch( rObj.GetObjIdentifier() )
+ {
+ case( OBJ_RECT ):
+ {
+ SdrRectObj* pRectObj = (SdrRectObj*) &rObj;
+ IMapRectangleObject* pObj = new IMapRectangleObject( pRectObj->GetLogicRect(),
+ String(), String(), String(), String(), String(), sal_True, sal_False );
+
+ pRectObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ break;
+
+ case( OBJ_CIRC ):
+ {
+ SdrCircObj* pCircObj = (SdrCircObj*) &rObj;
+ SdrPathObj* pPathObj = (SdrPathObj*) pCircObj->ConvertToPolyObj( sal_False, sal_False );
+ Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
+ delete pPathObj;
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( Polygon(aPoly), String(), String(), String(), String(), String(), sal_True, sal_False );
+ pObj->SetExtraEllipse( aPoly.GetBoundRect() );
+ pCircObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ break;
+
+ case( OBJ_POLY ):
+ case( OBJ_FREEFILL ):
+ case( OBJ_PATHPOLY ):
+ case( OBJ_PATHFILL ):
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*) &rObj;
+ const basegfx::B2DPolyPolygon& rXPolyPoly = pPathObj->GetPathPoly();
+
+ if ( rXPolyPoly.count() )
+ {
+ Polygon aPoly(rXPolyPoly.getB2DPolygon(0L));
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, String(), String(), String(), String(), String(), sal_True, sal_False );
+ pPathObj->InsertUserData( new IMapUserData( IMapObjectPtr(pObj) ) );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SdrObjChanged( const SdrObject& rObj )
+{
+ IMapUserData* pUserData = (IMapUserData*) rObj.GetUserData( 0 );
+
+ if ( pUserData )
+ {
+ String aURL;
+ String aAltText;
+ String aDesc;
+ String aTarget;
+ IMapObjectPtr pIMapObj = pUserData->GetObject();
+ sal_Bool bActive = sal_True;
+
+ if ( pIMapObj.get() )
+ {
+ aURL = pIMapObj->GetURL();
+ aAltText = pIMapObj->GetAltText();
+ aDesc = pIMapObj->GetDesc();
+ aTarget = pIMapObj->GetTarget();
+ bActive = pIMapObj->IsActive();
+ }
+
+ switch( rObj.GetObjIdentifier() )
+ {
+ case( OBJ_RECT ):
+ {
+ pUserData->ReplaceObject( IMapObjectPtr(new IMapRectangleObject( ( (const SdrRectObj&) rObj ).GetLogicRect(),
+ aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False ) ) );
+ }
+ break;
+
+ case( OBJ_CIRC ):
+ {
+ const SdrCircObj& rCircObj = (const SdrCircObj&) rObj;
+ SdrPathObj* pPathObj = (SdrPathObj*) rCircObj.ConvertToPolyObj( sal_False, sal_False );
+ Polygon aPoly(pPathObj->GetPathPoly().getB2DPolygon(0L));
+
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
+ pObj->SetExtraEllipse( aPoly.GetBoundRect() );
+
+ // wurde von uns nur temporaer angelegt
+ delete pPathObj;
+ pUserData->ReplaceObject( IMapObjectPtr(pObj) );
+ }
+ break;
+
+ case( OBJ_POLY ):
+ case( OBJ_FREEFILL ):
+ case( OBJ_PATHPOLY ):
+ case( OBJ_PATHFILL ):
+ {
+ const SdrPathObj& rPathObj = (const SdrPathObj&) rObj;
+ const basegfx::B2DPolyPolygon& rXPolyPoly = rPathObj.GetPathPoly();
+
+ if ( rXPolyPoly.count() )
+ {
+ Polygon aPoly(rPathObj.GetPathPoly().getB2DPolygon(0L));
+ IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, String(), bActive, sal_False );
+ pUserData->ReplaceObject( IMapObjectPtr(pObj) );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ GraphCtrl::MouseButtonUp( rMEvt );
+ UpdateInfo( sal_True );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::MarkListHasChanged()
+{
+ GraphCtrl::MarkListHasChanged();
+ UpdateInfo( sal_False );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const
+{
+ SdrObject* pObj = NULL;
+ Point aPt = PixelToLogic( rPosPixel );
+
+ if ( Rectangle( Point(), GetGraphicSize() ).IsInside( aPt ) )
+ {
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_uIntPtr nCount;
+
+ if ( pPage && ( ( nCount = pPage->GetObjCount() ) > 0 ) )
+ {
+ for ( long i = nCount - 1; i >= 0; i-- )
+ {
+ SdrObject* pTestObj = pPage->GetObj( i );
+ IMapObject* pIMapObj = GetIMapObj( pTestObj );
+
+ if ( pIMapObj && pIMapObj->IsHit( aPt ) )
+ {
+ pObj = pTestObj;
+ break;
+ }
+ }
+ }
+ }
+
+ return pObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) const
+{
+ IMapObject* pIMapObj = NULL;
+
+ if ( pSdrObj )
+ {
+ IMapUserData* pUserData = (IMapUserData*) pSdrObj->GetUserData( 0 );
+
+ if ( pUserData )
+ pIMapObj = pUserData->GetObject().get();
+ }
+
+ return pIMapObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SdrObject* IMapWindow::GetSdrObj( const IMapObject* pIMapObj ) const
+{
+ SdrObject* pSdrObj = NULL;
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ sal_uIntPtr nCount;
+
+ if ( pPage && ( ( nCount = pPage->GetObjCount() ) > 0 ) )
+ {
+ for ( sal_uIntPtr i = 0; i < nCount; i++ )
+ {
+ SdrObject* pTestObj = pPage->GetObj( i );
+
+ if ( pIMapObj == GetIMapObj( pTestObj ) )
+ {
+ pSdrObj = pTestObj;
+ break;
+ }
+ }
+ }
+
+ return pSdrObj;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::Command(const CommandEvent& rCEvt)
+{
+ Region aRegion;
+
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ PopupMenu aMenu( SVX_RES( RID_SVXMN_IMAP ) );
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ sal_uIntPtr nMarked = rMarkList.GetMarkCount();
+
+ aMenu.EnableItem( MN_URL, sal_False );
+ aMenu.EnableItem( MN_ACTIVATE, sal_False );
+ aMenu.EnableItem( MN_MACRO, sal_False );
+ aMenu.EnableItem( MN_MARK_ALL, pModel->GetPage( 0 )->GetObjCount() != pView->GetMarkedObjectCount() );
+
+ if ( !nMarked )
+ {
+ aMenu.EnableItem( MN_POSITION, sal_False );
+ aMenu.EnableItem( MN_FRAME_TO_TOP, sal_False );
+ aMenu.EnableItem( MN_MOREFRONT, sal_False );
+ aMenu.EnableItem( MN_MOREBACK, sal_False );
+ aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_False );
+ aMenu.EnableItem( MN_DELETE1, sal_False );
+ }
+ else
+ {
+ if ( nMarked == 1 )
+ {
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ aMenu.EnableItem( MN_URL, sal_True );
+ aMenu.EnableItem( MN_ACTIVATE, sal_True );
+ aMenu.EnableItem( MN_MACRO, sal_True );
+ aMenu.CheckItem( MN_ACTIVATE, GetIMapObj( pSdrObj )->IsActive() );
+ }
+
+ aMenu.EnableItem( MN_POSITION, sal_True );
+ aMenu.EnableItem( MN_FRAME_TO_TOP, sal_True );
+ aMenu.EnableItem( MN_MOREFRONT, sal_True );
+ aMenu.EnableItem( MN_MOREBACK, sal_True );
+ aMenu.EnableItem( MN_FRAME_TO_BOTTOM, sal_True );
+ aMenu.EnableItem( MN_DELETE1, sal_True );
+ }
+
+ aMenu.SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ else
+ Window::Command(rCEvt);
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Int8 IMapWindow::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ return( ( GetHitSdrObj( rEvt.maPosPixel ) != NULL ) ? rEvt.mnAction : DND_ACTION_NONE );
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if( IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) )
+ {
+ const String aString;
+ INetBookmark aBookMark( aString, aString );
+ SdrObject* pSdrObj = GetHitSdrObj( rEvt.maPosPixel );
+
+ if( pSdrObj && TransferableDataHelper( rEvt.maDropEvent.Transferable ).GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aBookMark ) )
+ {
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+
+ pIMapObj->SetURL( aBookMark.GetURL() );
+ pIMapObj->SetAltText( aBookMark.GetDescription() );
+ pModel->SetChanged( sal_True );
+ pView->UnmarkAll();
+ pView->MarkObj( pSdrObj, pView->GetSdrPageView() );
+ UpdateInfo( sal_True );
+ nRet = rEvt.mnAction;
+ }
+ }
+
+ return nRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ SdrObject* pSdrObj = NULL;
+ SdrPageView* pPageView = NULL;
+ Point aPos = PixelToLogic( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
+ {
+ if ( pView->PickObj( aPos, pView->getHitTolLog(), pSdrObj, pPageView ) )
+ {
+ const IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ String aStr;
+
+ if ( pIMapObj && ( aStr = pIMapObj->GetURL() ).Len() )
+ {
+ String aDescr( pIMapObj->GetAltText() );
+ Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetGraphicSize() ) ) );
+ Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
+ OutputToScreenPixel( aLogicPix.BottomRight() ) );
+
+ if ( Help::IsBalloonHelpEnabled() )
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, aStr );
+ else if ( Help::IsQuickHelpEnabled() )
+ Help::ShowQuickHelp( this, aScreenRect, aStr );
+ }
+ }
+ else
+ Window::RequestHelp( rHEvt );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::SetCurrentObjState( sal_Bool bActive )
+{
+ SdrObject* pObj = GetSelectedSdrObject();
+
+ if ( pObj )
+ {
+ SfxItemSet aSet( pModel->GetItemPool() );
+
+ GetIMapObj( pObj )->SetActive( bActive );
+
+ aSet.Put( XFillColorItem( String(), TRANSCOL ) );
+
+ if ( !bActive )
+ {
+ aSet.Put( XFillTransparenceItem( 100 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_RED ) ) );
+ }
+ else
+ {
+ aSet.Put( XFillTransparenceItem( 50 ) );
+ aSet.Put( XLineColorItem( String(), Color( COL_BLACK ) ) );
+ }
+
+ pView->SetAttributes( aSet, sal_False );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::UpdateInfo( sal_Bool bNewObj )
+{
+ if ( aInfoLink.IsSet() )
+ {
+ const SdrObject* pSdrObj = GetSelectedSdrObject();
+ const IMapObject* pIMapObj = pSdrObj ? GetIMapObj( pSdrObj ) : NULL;
+
+ aInfo.bNewObj = bNewObj;
+
+ if ( pIMapObj )
+ {
+ aInfo.bOneMarked = sal_True;
+ aInfo.aMarkURL = pIMapObj->GetURL();
+ aInfo.aMarkAltText = pIMapObj->GetAltText();
+ aInfo.aMarkTarget = pIMapObj->GetTarget();
+ aInfo.bActivated = pIMapObj->IsActive();
+ aInfoLink.Call( this );
+ }
+ else
+ {
+ aInfo.aMarkURL = aInfo.aMarkAltText = aInfo.aMarkTarget = String();
+ aInfo.bOneMarked = sal_False;
+ aInfo.bActivated = sal_False;
+ }
+
+ aInfoLink.Call( this );
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::DoMacroAssign()
+{
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ if ( pSdrObj )
+ {
+ SfxItemSet aSet( *pIMapPool, SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
+
+ SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
+ aNamesItem.AddEvent( String::CreateFromAscii( "MouseOver" ), String(), SFX_EVENT_MOUSEOVER_OBJECT );
+ aNamesItem.AddEvent( String::CreateFromAscii( "MouseOut" ), String(), SFX_EVENT_MOUSEOUT_OBJECT );
+ aSet.Put( aNamesItem );
+
+ SvxMacroItem aMacroItem(SID_ATTR_MACROITEM);
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
+ aSet.Put( aMacroItem, SID_ATTR_MACROITEM );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, mxDocumentFrame, SID_EVENTCONFIG );
+
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ pIMapObj->SetMacroTable( ((const SvxMacroItem& )pOutSet->Get( SID_ATTR_MACROITEM )).GetMacroTable() );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_False );
+ }
+
+ delete pMacroDlg;
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void IMapWindow::DoPropertyDialog()
+{
+ SdrObject* pSdrObj = GetSelectedSdrObject();
+
+ if ( pSdrObj )
+ {
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractURLDlg* aDlg = pFact->CreateURLDialog( this, pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(),
+ pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");
+ if ( aDlg->Execute() == RET_OK )
+ {
+ const String aURLText( aDlg->GetURL() );
+
+ if ( aURLText.Len() )
+ {
+ INetURLObject aObj( aURLText, INET_PROT_FILE );
+ DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL" );
+ pIMapObj->SetURL( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ }
+ else
+ pIMapObj->SetURL( aURLText );
+
+ pIMapObj->SetAltText( aDlg->GetAltText() );
+ pIMapObj->SetDesc( aDlg->GetDesc() );
+ pIMapObj->SetTarget( aDlg->GetTarget() );
+ pIMapObj->SetName( aDlg->GetName() );
+ pModel->SetChanged( sal_True );
+ UpdateInfo( sal_True );
+ }
+ delete aDlg; //add by CHINA001
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+IMPL_LINK( IMapWindow, MenuSelectHdl, Menu*, pMenu )
+{
+ if (pMenu)
+ {
+ sal_uInt16 nId = pMenu->GetCurItemId();
+
+ switch(nId)
+ {
+ case( MN_URL ):
+ DoPropertyDialog();
+ break;
+
+ case( MN_MACRO ):
+ DoMacroAssign();
+ break;
+
+ case( MN_ACTIVATE ):
+ {
+ const sal_Bool bNewState = !pMenu->IsItemChecked( MN_ACTIVATE );
+
+ pMenu->CheckItem( MN_ACTIVATE, bNewState );
+ SetCurrentObjState( bNewState );
+ UpdateInfo( sal_False );
+ }
+
+ case( MN_FRAME_TO_TOP ):
+ pView->PutMarkedToTop();
+ break;
+
+ case( MN_MOREFRONT ):
+ pView->MovMarkedToTop();
+ break;
+
+ case( MN_MOREBACK ):
+ pView->MovMarkedToBtm();
+ break;
+
+ case( MN_FRAME_TO_BOTTOM ):
+ pView->PutMarkedToBtm();
+ break;
+
+ case( MN_MARK_ALL ):
+ pView->MarkAll();
+ break;
+
+ case( MN_DELETE1 ):
+ pView->DeleteMarked();
+
+ default :
+ break;
+ }
+ }
+
+ return 0;
+}
+
+void IMapWindow::CreateDefaultObject()
+{
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(pPageView)
+ {
+ // calc position and size
+ Point aPagePos(0, 0); // = pPageView->GetOffset();
+ Size aPageSize = pPageView->GetPage()->GetSize();
+ sal_uInt32 nDefaultObjectSizeWidth = aPageSize.Width() / 4;
+ sal_uInt32 nDefaultObjectSizeHeight = aPageSize.Height() / 4;
+ aPagePos.X() += (aPageSize.Width() / 2) - (nDefaultObjectSizeWidth / 2);
+ aPagePos.Y() += (aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2);
+ Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), 0L, pModel);
+ pObj->SetLogicRect(aNewObjectRectangle);
+
+ switch( pObj->GetObjIdentifier() )
+ {
+ case OBJ_POLY:
+ case OBJ_PATHPOLY:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomLeft().X(), aNewObjectRectangle.BottomLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopLeft().X(), aNewObjectRectangle.TopLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopCenter().X(), aNewObjectRectangle.TopCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.Center().X(), aNewObjectRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.RightCenter().X(), aNewObjectRectangle.RightCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomRight().X(), aNewObjectRectangle.BottomRight().Y()));
+ aInnerPoly.setClosed(true);
+ ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ {
+ sal_Int32 nWdt(aNewObjectRectangle.GetWidth() / 2);
+ sal_Int32 nHgt(aNewObjectRectangle.GetHeight() / 2);
+ basegfx::B2DPolygon aInnerPoly(XPolygon(aNewObjectRectangle.Center(), nWdt, nHgt).getB2DPolygon());
+ ((SdrPathObj*)pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ }
+
+ pView->InsertObjectAtView(pObj, *pPageView);
+ SdrObjCreated( *pObj );
+ SetCurrentObjState( true );
+ pView->MarkObj( pObj, pPageView );
+ }
+}
+
+void IMapWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+/*
+ switch(aCode.GetCode())
+ {
+ case KEY_ESCAPE:
+ {
+ if ( pView->IsAction() )
+ {
+ pView->BrkAction();
+ return;
+ }
+ else if ( pView->AreObjectsMarked() )
+ {
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ pView->UnmarkAllObj();
+ ((Dialog*)GetParent())->GrabFocusToFirstControl();
+ }
+
+ return;
+ }
+ }
+ break;
+
+ }
+*/
+ GraphCtrl::KeyInput( rKEvt );
+}
+
+void IMapWindow::SelectFirstObject()
+{
+ SdrPage* pPage = (SdrPage*) pModel->GetPage( 0 );
+ if( pPage->GetObjCount() != 0 )
+ {
+ GrabFocus();
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(sal_True);
+ }
+}
+
+void IMapWindow::StartPolyEdit()
+{
+ GrabFocus();
+
+ if( !pView->AreObjectsMarked() )
+ pView->MarkNextObj(sal_True);
+
+ const SdrHdlList& rHdlList = pView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(!pHdl)
+ {
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(true);
+ }
+}
diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx
new file mode 100644
index 000000000000..bbc6a2c1ed6d
--- /dev/null
+++ b/svx/source/dialog/imapwnd.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _IMAPWND_HXX
+#define _IMAPWND_HXX
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/menu.hxx>
+#include <svl/itempool.hxx>
+#include <svtools/imapobj.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/imap.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/graphctl.hxx>
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+struct NotifyInfo
+{
+ String aMarkURL;
+ String aMarkAltText;
+ String aMarkTarget;
+ sal_Bool bNewObj;
+ sal_Bool bOneMarked;
+ sal_Bool bActivated;
+};
+
+
+struct NotifyPosSize
+{
+ Size aPictureSize;
+ Point aMousePos;
+ sal_Bool bPictureSize;
+ sal_Bool bMousePos;
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+#define SVD_IMAP_USERDATA 0x0001
+
+const sal_uInt32 IMapInventor = sal_uInt32('I') * 0x00000001+
+ sal_uInt32('M') * 0x00000100+
+ sal_uInt32('A') * 0x00010000+
+ sal_uInt32('P') * 0x01000000;
+
+
+typedef boost::shared_ptr< IMapObject > IMapObjectPtr;
+
+class IMapUserData : public SdrObjUserData
+{
+ // #i98386# use boost::shared_ptr here due to cloning possibilities
+ IMapObjectPtr mpObj;
+
+public:
+
+ IMapUserData() :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( ) {}
+
+ IMapUserData( const IMapObjectPtr& rIMapObj ) :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( rIMapObj ) {}
+
+ IMapUserData( const IMapUserData& rIMapUserData ) :
+ SdrObjUserData ( IMapInventor, SVD_IMAP_USERDATA, 0 ),
+ mpObj ( rIMapUserData.mpObj ) {}
+
+ ~IMapUserData() { }
+
+ virtual SdrObjUserData* Clone( SdrObject * ) const { return new IMapUserData( *this ); }
+
+ void SetObject( const IMapObjectPtr& rIMapObj ) { mpObj = rIMapObj; }
+ const IMapObjectPtr GetObject() const { return mpObj; }
+ void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; }
+};
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+/* move to cui //CHINA001
+class URLDlg : public ModalDialog
+{
+ FixedLine aFlURL;
+ FixedText aFtURL1;
+ Edit aEdtURL;
+ FixedText aFtURLDescription;
+ Edit aEdtURLDescription;
+ FixedText aFtTarget;
+ ComboBox aCbbTargets;
+ FixedText aFtName;
+ Edit aEdtName;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+
+public:
+
+ URLDlg( Window* pWindow,
+ const String& rURL, const String& rDescription,
+ const String& rTarget, const String& rName,
+ TargetList& rTargetList );
+
+ String GetURL() const { return aEdtURL.GetText(); }
+ String GetDescription() const { return aEdtURLDescription.GetText(); }
+ String GetTarget() const { return aCbbTargets.GetText(); }
+ String GetName() const { return aEdtName.GetText(); }
+};
+*/
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+class IMapWindow : public GraphCtrl, public DropTargetHelper
+{
+ NotifyInfo aInfo;
+ ImageMap aIMap;
+ TargetList aTargetList;
+ Link aInfoLink;
+ SfxItemPool* pIMapPool;
+ SfxItemInfo* pItemInfo;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
+ mxDocumentFrame;
+
+ DECL_LINK( MenuSelectHdl, Menu* );
+ DECL_LINK( MouseTimerHdl, Timer* );
+
+protected:
+
+ // GraphCtrl
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void Command(const CommandEvent& rCEvt);
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void SdrObjChanged( const SdrObject& rObj );
+ virtual void MarkListHasChanged();
+ virtual void InitSdrModel();
+
+ // DropTargetHelper
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ void CreateImageMap();
+ void ReplaceImageMap( const ImageMap& rNewImageMap, sal_Bool bScaleToGraphic );
+
+ void ClearTargetList();
+
+ SdrObject* CreateObj( const IMapObject* pIMapObj );
+ IMapObject* GetIMapObj( const SdrObject* pSdrObj ) const;
+ SdrObject* GetSdrObj( const IMapObject* pIMapObj ) const;
+ SdrObject* GetHitSdrObj( const Point& rPosPixel ) const;
+
+ void UpdateInfo( sal_Bool bNewObj );
+
+public:
+
+ IMapWindow( Window* pParent, const ResId& rResId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame );
+ ~IMapWindow();
+
+ sal_Bool ReplaceActualIMapInfo( const NotifyInfo& rNewInfo );
+
+ void SetImageMap( const ImageMap& rImageMap );
+ const ImageMap& GetImageMap();
+
+ void SetCurrentObjState( sal_Bool bActive );
+ void DoMacroAssign();
+ void DoPropertyDialog();
+
+ void SetInfoLink( const Link& rLink ) { aInfoLink = rLink; }
+ const Link& GetInfoLink() const { return aInfoLink; }
+
+ void SetTargetList( TargetList& rTargetList );
+ const TargetList& GetTargetList() const { return aTargetList; }
+
+ const NotifyInfo& GetInfo() const { return aInfo; }
+
+ void CreateDefaultObject();
+ void SelectFirstObject();
+ void StartPolyEdit();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
new file mode 100644
index 000000000000..cdc4cfc0b9b8
--- /dev/null
+++ b/svx/source/dialog/langbox.cxx
@@ -0,0 +1,526 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <com/sun/star/linguistic2/XLinguServiceManager.hdl>
+#include <com/sun/star/linguistic2/XAvailableLocales.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <linguistic/misc.hxx>
+#include <rtl/ustring.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <tools/urlobj.hxx>
+#include <svtools/langtab.hxx>
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <i18npool/lang.h>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/langbox.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::uno;
+
+// -----------------------------------------------------------------------
+
+String GetDicInfoStr( const String& rName, const sal_uInt16 nLang, sal_Bool bNeg )
+{
+ INetURLObject aURLObj;
+ aURLObj.SetSmartProtocol( INET_PROT_FILE );
+ aURLObj.SetSmartURL( rName, INetURLObject::ENCODE_ALL );
+ String aTmp( aURLObj.GetBase() );
+ aTmp += sal_Unicode( ' ' );
+
+ if ( bNeg )
+ {
+ sal_Char const sTmp[] = " (-) ";
+ aTmp.AppendAscii( sTmp );
+ }
+
+ if ( LANGUAGE_NONE == nLang )
+ aTmp += String( ResId( RID_SVXSTR_LANGUAGE_ALL, DIALOG_MGR() ) );
+ else
+ {
+ aTmp += sal_Unicode( '[' );
+ aTmp += SvtLanguageTable::GetLanguageString( (LanguageType)nLang );
+ aTmp += sal_Unicode( ']' );
+ }
+
+ return aTmp;
+}
+
+//========================================================================
+// misc local helper functions
+//========================================================================
+
+static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( Sequence< Locale > &rSeq )
+{
+ const Locale *pLocale = rSeq.getConstArray();
+ sal_Int32 nCount = rSeq.getLength();
+
+ Sequence< sal_Int16 > aLangs( nCount );
+ sal_Int16 *pLang = aLangs.getArray();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ pLang[i] = SvxLocaleToLanguage( pLocale[i] );
+
+ }
+
+ return aLangs;
+}
+
+
+static sal_Bool lcl_SeqHasLang( const Sequence< sal_Int16 > & rLangSeq, sal_Int16 nLang )
+{
+ sal_Int32 i = -1;
+ sal_Int32 nLen = rLangSeq.getLength();
+ if (nLen)
+ {
+ const sal_Int16 *pLang = rLangSeq.getConstArray();
+ for (i = 0; i < nLen; ++i)
+ {
+ if (nLang == pLang[i])
+ break;
+ }
+ }
+ return i >= 0 && i < nLen;
+}
+
+//========================================================================
+// class SvxLanguageBox
+//========================================================================
+
+sal_uInt16 TypeToPos_Impl( LanguageType eType, const ListBox& rLb )
+{
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+ sal_uInt16 nCount = rLb.GetEntryCount();
+
+ for ( sal_uInt16 i=0; nPos == LISTBOX_ENTRY_NOTFOUND && i<nCount; i++ )
+ if ( eType == LanguageType((sal_uIntPtr)rLb.GetEntryData(i)) )
+ nPos = i;
+
+ return nPos;
+}
+
+//-----------------------------------------------------------------------
+SvxLanguageBox::SvxLanguageBox( Window* pParent, WinBits nWinStyle, sal_Bool bCheck ) :
+ ListBox( pParent, nWinStyle ),
+ m_pSpellUsedLang( NULL ),
+ m_bWithCheckmark( bCheck )
+{
+ Init();
+}
+//------------------------------------------------------------------------
+SvxLanguageBox::SvxLanguageBox( Window* pParent, const ResId& rResId, sal_Bool bCheck ) :
+ ListBox( pParent, rResId ),
+ m_pSpellUsedLang( NULL ),
+ m_bWithCheckmark( bCheck )
+{
+ Init();
+}
+//------------------------------------------------------------------------
+void SvxLanguageBox::Init()
+{
+ m_pLangTable = new SvtLanguageTable;
+ m_aNotCheckedImage = Image( SVX_RES( RID_SVXIMG_NOTCHECKED ) );
+ m_aCheckedImage = Image( SVX_RES( RID_SVXIMG_CHECKED ) );
+ m_aCheckedImageHC = Image( SVX_RES( RID_SVXIMG_CHECKED_H ) );
+ m_aAllString = String( SVX_RESSTR( RID_SVXSTR_LANGUAGE_ALL ) );
+ m_nLangList = LANG_LIST_EMPTY;
+ m_bHasLangNone = sal_False;
+ m_bLangNoneIsLangAll = sal_False;
+
+ // display entries sorted
+ SetStyle( GetStyle() | WB_SORT );
+
+ if ( m_bWithCheckmark )
+ {
+ SvtLanguageTable aLangTable;
+ sal_uInt32 nCount = aLangTable.GetEntryCount();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ LanguageType nLangType = aLangTable.GetTypeAtIndex( i );
+
+ sal_Bool bInsert = sal_True;
+ if ((LANGUAGE_DONTKNOW == nLangType) ||
+ (LANGUAGE_SYSTEM == nLangType) ||
+ (LANGUAGE_USER1 <= nLangType && nLangType <= LANGUAGE_USER9))
+ {
+ bInsert = sal_False;
+ }
+
+ if ( bInsert )
+ InsertLanguage( nLangType );
+ }
+ m_nLangList = LANG_LIST_ALL;
+ }
+}
+//------------------------------------------------------------------------
+
+SvxLanguageBox::~SvxLanguageBox()
+{
+ delete m_pSpellUsedLang;
+ delete m_pLangTable;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::ImplInsertImgEntry( const String& rEntry, sal_uInt16 nPos, bool bChecked )
+{
+ sal_uInt16 nRet = 0;
+ if( !bChecked )
+ nRet = InsertEntry( rEntry, m_aNotCheckedImage, nPos );
+ else if( GetSettings().GetStyleSettings().GetHighContrastMode() )
+ nRet = InsertEntry( rEntry, m_aCheckedImageHC, nPos );
+ else
+ nRet = InsertEntry( rEntry, m_aCheckedImage, nPos );
+ return nRet;
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::SetLanguageList( sal_Int16 nLangList,
+ sal_Bool bHasLangNone, sal_Bool bLangNoneIsLangAll, sal_Bool bCheckSpellAvail )
+{
+ Clear();
+
+ m_nLangList = nLangList;
+ m_bHasLangNone = bHasLangNone;
+ m_bLangNoneIsLangAll = bLangNoneIsLangAll;
+ m_bWithCheckmark = bCheckSpellAvail;
+
+ if ( LANG_LIST_EMPTY != nLangList )
+ {
+ Sequence< sal_Int16 > aSpellAvailLang;
+ Sequence< sal_Int16 > aHyphAvailLang;
+ Sequence< sal_Int16 > aThesAvailLang;
+ Sequence< sal_Int16 > aSpellUsedLang;
+ Sequence< sal_Int16 > aHyphUsedLang;
+ Sequence< sal_Int16 > aThesUsedLang;
+ Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
+ if (xAvail.is())
+ {
+ Sequence< Locale > aTmp;
+
+ if (LANG_LIST_SPELL_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_SPELLCHECKER ) );
+ aSpellAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ if (LANG_LIST_HYPH_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_HYPHENATOR ) );
+ aHyphAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ if (LANG_LIST_THES_AVAIL & nLangList)
+ {
+ aTmp = xAvail->getAvailableLocales( A2OU( SN_THESAURUS ) );
+ aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
+ }
+ }
+ if (LANG_LIST_SPELL_USED & nLangList)
+ {
+ Reference< XSpellChecker1 > xTmp1( SvxGetSpellChecker(), UNO_QUERY );
+ if (xTmp1.is())
+ aSpellUsedLang = xTmp1->getLanguages();
+ }
+ if (LANG_LIST_HYPH_USED & nLangList)
+ {
+ Reference< XHyphenator > xTmp( SvxGetHyphenator() );
+ if (xTmp.is()) {
+ Sequence < Locale > aLocaleSequence( xTmp->getLocales() );
+ aHyphUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
+ }
+ }
+ if (LANG_LIST_THES_USED & nLangList)
+ {
+ Reference< XThesaurus > xTmp( SvxGetThesaurus() );
+ if (xTmp.is()) {
+ Sequence < Locale > aLocaleSequence( xTmp->getLocales() );
+ aThesUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
+ }
+ }
+
+ SvtLanguageTable aLangTable;
+ ::com::sun::star::uno::Sequence< sal_uInt16 > xKnown;
+ const sal_uInt16* pKnown;
+ sal_uInt32 nCount;
+ if ( nLangList & LANG_LIST_ONLY_KNOWN )
+ {
+ xKnown = LocaleDataWrapper::getInstalledLanguageTypes();
+ pKnown = xKnown.getConstArray();
+ nCount = xKnown.getLength();
+ }
+ else
+ {
+ nCount = aLangTable.GetEntryCount();
+ pKnown = NULL;
+ }
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ LanguageType nLangType;
+ if ( nLangList & LANG_LIST_ONLY_KNOWN )
+ nLangType = pKnown[i];
+ else
+ nLangType = aLangTable.GetTypeAtIndex( i );
+ if ( nLangType != LANGUAGE_DONTKNOW &&
+ nLangType != LANGUAGE_SYSTEM &&
+ nLangType != LANGUAGE_NONE &&
+ (nLangType < LANGUAGE_USER1 || nLangType > LANGUAGE_USER9) &&
+ (MsLangId::getSubLanguage( nLangType) != 0 ||
+ (nLangList & LANG_LIST_ALSO_PRIMARY_ONLY)) &&
+ ((nLangList & LANG_LIST_ALL) != 0 ||
+ ((nLangList & LANG_LIST_WESTERN) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_LATIN)) ||
+ ((nLangList & LANG_LIST_CTL) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_COMPLEX)) ||
+ ((nLangList & LANG_LIST_CJK) != 0 &&
+ (SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
+ SCRIPTTYPE_ASIAN)) ||
+ ((nLangList & LANG_LIST_FBD_CHARS) != 0 &&
+ MsLangId::hasForbiddenCharacters(nLangType)) ||
+ ((nLangList & LANG_LIST_SPELL_AVAIL) != 0 &&
+ lcl_SeqHasLang(aSpellAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_HYPH_AVAIL) != 0 &&
+ lcl_SeqHasLang(aHyphAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_THES_AVAIL) != 0 &&
+ lcl_SeqHasLang(aThesAvailLang, nLangType)) ||
+ ((nLangList & LANG_LIST_SPELL_USED) != 0 &&
+ lcl_SeqHasLang(aSpellUsedLang, nLangType)) ||
+ ((nLangList & LANG_LIST_HYPH_USED) != 0 &&
+ lcl_SeqHasLang(aHyphUsedLang, nLangType)) ||
+ ((nLangList & LANG_LIST_THES_USED) != 0 &&
+ lcl_SeqHasLang(aThesUsedLang, nLangType))) )
+ InsertLanguage( nLangType );
+ }
+
+ if (bHasLangNone)
+ InsertLanguage( LANGUAGE_NONE );
+ }
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType nLangType, sal_uInt16 nPos )
+{
+ return ImplInsertLanguage( nLangType, nPos, ::com::sun::star::i18n::ScriptType::WEAK );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::ImplInsertLanguage( const LanguageType nLangType, sal_uInt16 nPos, sal_Int16 nType )
+{
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType);
+ // For obsolete and to be replaced languages check whether an entry of the
+ // replacement already exists and if so don't add an entry with identical
+ // string as would be returned by SvtLanguageTable::GetString().
+ if (nLang != nLangType)
+ {
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return nAt;
+ }
+
+ String aStrEntry = m_pLangTable->GetString( nLang );
+ if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll)
+ aStrEntry = m_aAllString;
+
+ LanguageType nRealLang = nLang;
+ if (nRealLang == LANGUAGE_SYSTEM)
+ {
+ nRealLang = MsLangId::resolveSystemLanguageByScriptType(nRealLang, nType);
+ aStrEntry.AppendAscii(" - ");
+ aStrEntry.Append(m_pLangTable->GetString( nRealLang ));
+ }
+
+ aStrEntry = ApplyLreOrRleEmbedding( aStrEntry );
+
+ sal_uInt16 nAt = 0;
+ if ( m_bWithCheckmark )
+ {
+ sal_Bool bFound = sal_False;
+
+ if (!m_pSpellUsedLang)
+ {
+ Reference< XSpellChecker1 > xSpell( SvxGetSpellChecker(), UNO_QUERY );
+ if ( xSpell.is() )
+ m_pSpellUsedLang = new Sequence< sal_Int16 >( xSpell->getLanguages() );
+ }
+ bFound = m_pSpellUsedLang ?
+ lcl_SeqHasLang( *m_pSpellUsedLang, nRealLang ) : sal_False;
+
+ nAt = ImplInsertImgEntry( aStrEntry, nPos, bFound );
+ }
+ else
+ nAt = InsertEntry( aStrEntry, nPos );
+
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nLangType );
+ return nAt;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertDefaultLanguage( sal_Int16 nType, sal_uInt16 nPos )
+{
+ return ImplInsertLanguage( LANGUAGE_SYSTEM, nPos, nType );
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType nLangType,
+ sal_Bool bCheckEntry, sal_uInt16 nPos )
+{
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType);
+ // For obsolete and to be replaced languages check whether an entry of the
+ // replacement already exists and if so don't add an entry with identical
+ // string as would be returned by SvtLanguageTable::GetString().
+ if (nLang != nLangType)
+ {
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return nAt;
+ }
+
+ String aStrEntry = m_pLangTable->GetString( nLang );
+ if (LANGUAGE_NONE == nLang && m_bHasLangNone && m_bLangNoneIsLangAll)
+ aStrEntry = m_aAllString;
+
+ sal_uInt16 nAt = ImplInsertImgEntry( aStrEntry, nPos, bCheckEntry );
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nLang );
+
+ return nAt;
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::RemoveLanguage( const LanguageType eLangType )
+{
+ sal_uInt16 nAt = TypeToPos_Impl( eLangType, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nAt );
+}
+
+//------------------------------------------------------------------------
+
+LanguageType SvxLanguageBox::GetSelectLanguage() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return LanguageType( (sal_uIntPtr)GetEntryData(nPos) );
+ else
+ return LanguageType( LANGUAGE_DONTKNOW );
+}
+
+//------------------------------------------------------------------------
+
+void SvxLanguageBox::SelectLanguage( const LanguageType eLangType, sal_Bool bSelect )
+{
+ // If the core uses a LangID of an imported MS document and wants to select
+ // a language that is replaced, we need to select the replacement instead.
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( eLangType);
+
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nAt, bSelect );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxLanguageBox::IsLanguageSelected( const LanguageType eLangType ) const
+{
+ // Same here, work on the replacement if applicable.
+ LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( eLangType);
+
+ sal_uInt16 nAt = TypeToPos_Impl( nLang, *this );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nAt );
+ else
+ return sal_False;
+}
+
+#if ENABLE_LAYOUT
+
+namespace layout
+{
+
+SvxLanguageBox::~SvxLanguageBox ()
+{
+}
+
+SvxLanguageBox::SvxLanguageBox( Context* pParent, const char* pFile, sal_Bool bCheck )
+: ListBox ( pParent, pFile, bCheck )
+{
+}
+
+void SvxLanguageBox::SetLanguageList( sal_Int16/*list*/, bool/*hasLangNone*/, bool /*langNoneIsLangAll*/, bool /*checkSpellAvail*/)
+{
+}
+
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType/*type*/, sal_uInt16/*pos*/)
+{
+ return 0;
+}
+sal_uInt16 SvxLanguageBox::InsertLanguage( const LanguageType/*type*/, bool/*checkEntry*/, sal_uInt16 /*pos*/)
+{
+ return 0;
+}
+void SvxLanguageBox::RemoveLanguage( const LanguageType/*type*/)
+{
+}
+void SvxLanguageBox::SelectLanguage( const LanguageType/*type*/, bool/*select*/)
+{
+}
+LanguageType SvxLanguageBox::GetSelectLanguage() const
+{
+ return 0;
+}
+bool SvxLanguageBox::IsLanguageSelected( const LanguageType/*type*/) const
+{
+ return true;
+}
+
+/*IMPL_IMPL (SvxLanguageBox, ListBox);
+IMPL_CONSTRUCTORS ( SvxLanguageBox, ListBox, "svxlanguagebox" );
+IMPL_GET_IMPL( SvxLanguageBox );
+IMPL_GET_WINDOW (SvxLanguageBox);*/
+};
+
+#endif
+
diff --git a/svx/source/dialog/langbox.src b/svx/source/dialog/langbox.src
new file mode 100644
index 000000000000..79bf1cf010c3
--- /dev/null
+++ b/svx/source/dialog/langbox.src
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+
+Image RID_SVXIMG_NOTCHECKED
+{
+ ImageBitmap = Bitmap { File = "notcheck.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+Image RID_SVXIMG_CHECKED
+{
+ ImageBitmap = Bitmap { File = "lngcheck.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+Image RID_SVXIMG_CHECKED_H
+{
+ ImageBitmap = Bitmap { File = "lngcheck_h.bmp" ; } ;
+ MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+};
+
+// ********************************************************************** EOF
+
diff --git a/svx/source/dialog/language.src b/svx/source/dialog/language.src
new file mode 100644
index 000000000000..aa2bee89d742
--- /dev/null
+++ b/svx/source/dialog/language.src
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+ // pragma ----------------------------------------------------------------
+
+ // Language-Strings ------------------------------------------------------
+
+String RID_SVXSTR_LANGUAGE_ALL
+{
+ Text [ en-US ] = "[All]" ;
+};
+
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
new file mode 100644
index 000000000000..df93370dda8e
--- /dev/null
+++ b/svx/source/dialog/measctrl.cxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/svdomeas.hxx>
+#include <svx/svdmodel.hxx>
+
+#include "svx/measctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+
+/*************************************************************************
+|*
+|* Ctor SvxXMeasurePreview
+|*
+*************************************************************************/
+
+SvxXMeasurePreview::SvxXMeasurePreview
+(
+ Window* pParent,
+ const ResId& rResId,
+ const SfxItemSet& rInAttrs
+) :
+
+ Control ( pParent, rResId ),
+ rAttrs ( rInAttrs )
+
+{
+ SetMapMode( MAP_100TH_MM );
+
+ Size aSize = GetOutputSize();
+
+ // Massstab: 1:2
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetScaleX( Fraction( 1, 2 ) );
+ aMapMode.SetScaleY( Fraction( 1, 2 ) );
+ SetMapMode( aMapMode );
+
+ aSize = GetOutputSize();
+ Rectangle aRect = Rectangle( Point(), aSize );
+ Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) );
+ Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) );
+
+ pMeasureObj = new SdrMeasureObj( aPt1, aPt2 );
+ pModel = new SdrModel();
+ pMeasureObj->SetModel( pModel );
+
+ //pMeasureObj->SetItemSetAndBroadcast(rInAttrs);
+ pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* Dtor SvxXMeasurePreview
+|*
+*************************************************************************/
+
+SvxXMeasurePreview::~SvxXMeasurePreview()
+{
+ // #111111#
+ // No one is deleting the MeasureObj? This is not only an error but also
+ // a memory leak (!). Main problem is that this object is still listening to
+ // a StyleSheet of the model which was set. Thus, if You want to keep the obnject,
+ // set the modfel to 0L, if object is not needed (seems to be the case here),
+ // delete it.
+ delete pMeasureObj;
+
+ delete pModel;
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: Paint()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::Paint( const Rectangle& )
+{
+ pMeasureObj->SingleObjectPainter(*this); // #110094#-17
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::SetAttributes( const SfxItemSet& rInAttrs )
+{
+ //pMeasureObj->SetItemSetAndBroadcast(rInAttrs);
+ pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs);
+
+ Invalidate();
+}
+
+/*************************************************************************
+|*
+|* SvxXMeasurePreview: SetAttributes()
+|*
+*************************************************************************/
+
+void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ sal_Bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
+ sal_Bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
+ sal_Bool bCtrl = rMEvt.IsMod1();
+
+ if( bZoomIn || bZoomOut )
+ {
+ MapMode aMapMode = GetMapMode();
+ Fraction aXFrac = aMapMode.GetScaleX();
+ Fraction aYFrac = aMapMode.GetScaleY();
+ Fraction* pMultFrac;
+
+ if( bZoomIn )
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 3, 2 );
+ else
+ pMultFrac = new Fraction( 11, 10 );
+ }
+ else
+ {
+ if( bCtrl )
+ pMultFrac = new Fraction( 2, 3 );
+ else
+ pMultFrac = new Fraction( 10, 11 );
+ }
+
+ aXFrac *= *pMultFrac;
+ aYFrac *= *pMultFrac;
+ if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
+ (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 )
+ {
+ aMapMode.SetScaleX( aXFrac );
+ aMapMode.SetScaleY( aYFrac );
+ SetMapMode( aMapMode );
+
+ Size aOutSize( GetOutputSize() );
+
+ Point aPt( aMapMode.GetOrigin() );
+ long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 );
+ aPt.X() += nX;
+ aPt.Y() += nY;
+
+ aMapMode.SetOrigin( aPt );
+ SetMapMode( aMapMode );
+
+ Invalidate();
+ }
+ delete pMultFrac;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxXMeasurePreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
+ }
+}
+
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
new file mode 100644
index 000000000000..83d8206111f8
--- /dev/null
+++ b/svx/source/dialog/optgrid.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/module.hxx>
+#include <svl/intitem.hxx>
+
+#define _SVX_OPTGRID_CXX
+
+#include <svx/svxids.hrc>
+#include <svx/dialmgr.hxx>
+#include "svx/optgrid.hxx"
+#include <svx/dialogs.hrc>
+#include "optgrid.hrc"
+#include "svx/dlgutil.hxx"
+
+/* -----------------18.08.98 17:41-------------------
+ * local functions
+ * --------------------------------------------------*/
+void lcl_GetMinMax(MetricField& rField, long& nFirst, long& nLast, long& nMin, long& nMax)
+{
+ nFirst = static_cast<long>(rField.Denormalize( rField.GetFirst( FUNIT_TWIP ) ));
+ nLast = static_cast<long>(rField.Denormalize( rField.GetLast( FUNIT_TWIP ) ));
+ nMin = static_cast<long>(rField.Denormalize( rField.GetMin( FUNIT_TWIP ) ));
+ nMax = static_cast<long>(rField.Denormalize( rField.GetMax( FUNIT_TWIP ) ));
+}
+
+void lcl_SetMinMax(MetricField& rField, long nFirst, long nLast, long nMin, long nMax)
+{
+ rField.SetFirst( rField.Normalize( nFirst ), FUNIT_TWIP );
+ rField.SetLast( rField.Normalize( nLast ), FUNIT_TWIP );
+ rField.SetMin( rField.Normalize( nMin ), FUNIT_TWIP );
+ rField.SetMax( rField.Normalize( nMax ), FUNIT_TWIP );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rastereinstellungen Ctor
+ --------------------------------------------------------------------*/
+
+SvxOptionsGrid::SvxOptionsGrid() :
+ nFldDrawX ( 100 ),
+ nFldDivisionX ( 0 ),
+ nFldDrawY ( 100 ),
+ nFldDivisionY ( 0 ),
+ nFldSnapX ( 100 ),
+ nFldSnapY ( 100 ),
+ bUseGridsnap ( 0 ),
+ bSynchronize ( 1 ),
+ bGridVisible ( 0 ),
+ bEqualGrid ( 1 )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rastereinstellungen Dtor
+ --------------------------------------------------------------------*/
+
+SvxOptionsGrid::~SvxOptionsGrid()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Item fuer Rastereinstellungen
+ --------------------------------------------------------------------*/
+
+SvxGridItem::SvxGridItem( const SvxGridItem& rItem )
+: SvxOptionsGrid()
+, SfxPoolItem(rItem)
+{
+ bUseGridsnap = rItem.bUseGridsnap ;
+ bSynchronize = rItem.bSynchronize ;
+ bGridVisible = rItem.bGridVisible ;
+ bEqualGrid = rItem.bEqualGrid ;
+ nFldDrawX = rItem.nFldDrawX ;
+ nFldDivisionX= rItem.nFldDivisionX;
+ nFldDrawY = rItem.nFldDrawY ;
+ nFldDivisionY= rItem.nFldDivisionY;
+ nFldSnapX = rItem.nFldSnapX ;
+ nFldSnapY = rItem.nFldSnapY ;
+
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SvxGridItem::Clone( SfxItemPool* ) const
+{
+ return new SvxGridItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SvxGridItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SvxGridItem& rItem = (const SvxGridItem&) rAttr;
+
+ return ( bUseGridsnap == rItem.bUseGridsnap &&
+ bSynchronize == rItem.bSynchronize &&
+ bGridVisible == rItem.bGridVisible &&
+ bEqualGrid == rItem.bEqualGrid &&
+ nFldDrawX == rItem.nFldDrawX &&
+ nFldDivisionX== rItem.nFldDivisionX&&
+ nFldDrawY == rItem.nFldDrawY &&
+ nFldDivisionY== rItem.nFldDivisionY&&
+ nFldSnapX == rItem.nFldSnapX &&
+ nFldSnapY == rItem.nFldSnapY );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxItemPresentation SvxGridItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText, const IntlWrapper *
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = String::CreateFromAscii("SvxGridItem");
+ return ePres;
+ default:
+ return SFX_ITEM_PRESENTATION_NONE;
+ }
+}
+
+
+/*----------------- OS 23.02.95 -----------------------
+ TabPage Rastereinstellungen
+-------------------------------------------------------*/
+
+SvxGridTabPage::SvxGridTabPage( Window* pParent, const SfxItemSet& rCoreSet) :
+
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_GRID ), rCoreSet ),
+
+ aCbxUseGridsnap ( this, SVX_RES( CBX_USE_GRIDSNAP ) ),
+ aCbxGridVisible ( this, SVX_RES( CBX_GRID_VISIBLE ) ),
+
+ aFlResolution ( this, SVX_RES( FL_RESOLUTION ) ),
+ aFtDrawX ( this, SVX_RES( FT_DRAW_X ) ),
+ aMtrFldDrawX ( this, SVX_RES( MTR_FLD_DRAW_X ) ),
+ aFtDrawY ( this, SVX_RES( FT_DRAW_Y ) ),
+ aMtrFldDrawY ( this, SVX_RES( MTR_FLD_DRAW_Y ) ),
+
+ aFlDivision ( this, SVX_RES( FL_DIVISION ) ),
+ aFtDivisionX( this, SVX_RES( FT_DIVISION_X) ),
+ aNumFldDivisionX( this, SVX_RES( NUM_FLD_DIVISION_X ) ),
+ aDivisionPointX( this, SVX_RES( FT_HORZ_POINTS) ),
+
+ aFtDivisionY( this, SVX_RES( FT_DIVISION_Y) ),
+ aNumFldDivisionY( this, SVX_RES( NUM_FLD_DIVISION_Y ) ),
+ aDivisionPointY( this, SVX_RES( FT_VERT_POINTS) ),
+
+ aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
+ aGrpDrawGrid ( this, SVX_RES( GRP_DRAWGRID ) ),
+
+ aGrpSnap ( this, SVX_RES( GRP_SNAP ) ),
+ aCbxSnapHelplines ( this, SVX_RES( CBX_SNAP_HELPLINES ) ),
+ aCbxSnapBorder ( this, SVX_RES( CBX_SNAP_BORDER ) ),
+ aCbxSnapFrame ( this, SVX_RES( CBX_SNAP_FRAME ) ),
+ aCbxSnapPoints ( this, SVX_RES( CBX_SNAP_POINTS ) ),
+ aFtSnapArea ( this, SVX_RES( FT_SNAP_AREA ) ),
+ aMtrFldSnapArea ( this, SVX_RES( MTR_FLD_SNAP_AREA ) ),
+
+ aSeparatorFL ( this, SVX_RES( FL_SEPARATOR ) ),
+
+ aGrpOrtho ( this, SVX_RES( GRP_ORTHO ) ),
+ aCbxOrtho ( this, SVX_RES( CBX_ORTHO ) ),
+ aCbxBigOrtho ( this, SVX_RES( CBX_BIGORTHO ) ),
+ aCbxRotate ( this, SVX_RES( CBX_ROTATE ) ),
+ aMtrFldAngle ( this, SVX_RES( MTR_FLD_ANGLE ) ),
+ aFtBezAngle ( this, SVX_RES( FT_BEZ_ANGLE ) ),
+ aMtrFldBezAngle ( this, SVX_RES( MTR_FLD_BEZ_ANGLE ) ),
+
+ bAttrModified( sal_False )
+{
+ // diese Page braucht ExchangeSupport
+ SetExchangeSupport();
+
+ FreeResource();
+
+ aDivisionPointY.SetText(aDivisionPointX.GetText());
+ // Metrik einstellen
+ FieldUnit eFUnit = GetModuleFieldUnit( rCoreSet );
+ long nFirst, nLast, nMin, nMax;
+
+ lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+
+ lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+
+
+ aCbxRotate.SetClickHdl( LINK( this, SvxGridTabPage, ClickRotateHdl_Impl ) );
+ Link aLink = LINK( this, SvxGridTabPage, ChangeGridsnapHdl_Impl );
+ aCbxUseGridsnap.SetClickHdl( aLink );
+ aCbxSynchronize.SetClickHdl( aLink );
+ aCbxGridVisible.SetClickHdl( aLink );
+ aMtrFldDrawX.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
+ aMtrFldDrawY.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDrawHdl_Impl ) );
+ aNumFldDivisionX.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
+ aNumFldDivisionY.SetModifyHdl(
+ LINK( this, SvxGridTabPage, ChangeDivisionHdl_Impl ) );
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SvxGridTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return ( new SvxGridTabPage( pParent, rAttrSet ) );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxGridTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ if ( bAttrModified )
+ {
+ SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS );
+
+ aGridItem.bUseGridsnap = aCbxUseGridsnap.IsChecked();
+ aGridItem.bSynchronize = aCbxSynchronize.IsChecked();
+ aGridItem.bGridVisible = aCbxGridVisible.IsChecked();
+
+ SfxMapUnit eUnit =
+ rCoreSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
+ long nX =GetCoreValue( aMtrFldDrawX, eUnit );
+ long nY = GetCoreValue( aMtrFldDrawY, eUnit );
+
+ aGridItem.nFldDrawX = (sal_uInt32) nX;
+ aGridItem.nFldDrawY = (sal_uInt32) nY;
+ aGridItem.nFldDivisionX = static_cast<long>(aNumFldDivisionX.GetValue()-1);
+ aGridItem.nFldDivisionY = static_cast<long>(aNumFldDivisionY.GetValue()-1);
+
+ rCoreSet.Put( aGridItem );
+ }
+ return bAttrModified;
+}
+
+//------------------------------------------------------------------------
+
+void SvxGridTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pAttr = 0;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SvxGridItem* pGridAttr = (SvxGridItem*)pAttr;
+ aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
+ aCbxSynchronize.Check( pGridAttr->bSynchronize == 1 );
+ aCbxGridVisible.Check( pGridAttr->bGridVisible == 1 );
+
+ SfxMapUnit eUnit =
+ rSet.GetPool()->GetMetric( GetWhich( SID_ATTR_GRID_OPTIONS ) );
+ SetMetricValue( aMtrFldDrawX , pGridAttr->nFldDrawX, eUnit );
+ SetMetricValue( aMtrFldDrawY , pGridAttr->nFldDrawY, eUnit );
+
+ aNumFldDivisionX.SetValue( pGridAttr->nFldDivisionX+1 );
+ aNumFldDivisionY.SetValue( pGridAttr->nFldDivisionY+1 );
+ }
+
+ ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
+ bAttrModified = sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pAttr = NULL;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SvxGridItem* pGridAttr = (SvxGridItem*) pAttr;
+ aCbxUseGridsnap.Check( pGridAttr->bUseGridsnap == 1 );
+
+ ChangeGridsnapHdl_Impl( &aCbxUseGridsnap );
+ }
+
+ // Metrik ggfs. aendern (da TabPage im Dialog liegt,
+ // wo die Metrik eingestellt werden kann
+ //sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
+ //if( rSet.GetItemState( GetWhich( SID_ATTR_METRIC ) ) >= SFX_ITEM_AVAILABLE )
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False,
+ (const SfxPoolItem**)&pAttr ))
+ {
+ const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr;
+
+ FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue();
+
+ if( eFUnit != aMtrFldDrawX.GetUnit() )
+ {
+ // Metriken einstellen
+ long nFirst, nLast, nMin, nMax;
+ long nVal = static_cast<long>(aMtrFldDrawX.Denormalize( aMtrFldDrawX.GetValue( FUNIT_TWIP ) ));
+
+ lcl_GetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawX, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawX, nFirst, nLast, nMin, nMax);
+
+ aMtrFldDrawX.SetValue( aMtrFldDrawX.Normalize( nVal ), FUNIT_TWIP );
+
+ nVal = static_cast<long>(aMtrFldDrawY.Denormalize( aMtrFldDrawY.GetValue( FUNIT_TWIP ) ));
+ lcl_GetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ SetFieldUnit( aMtrFldDrawY, eFUnit, sal_True );
+ lcl_SetMinMax(aMtrFldDrawY, nFirst, nLast, nMin, nMax);
+ aMtrFldDrawY.SetValue( aMtrFldDrawY.Normalize( nVal ), FUNIT_TWIP );
+
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+int SvxGridTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if ( _pSet )
+ FillItemSet( *_pSet );
+ return( LEAVE_PAGE );
+}
+//------------------------------------------------------------------------
+IMPL_LINK( SvxGridTabPage, ChangeDrawHdl_Impl, MetricField *, pField )
+{
+ bAttrModified = sal_True;
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if(pField == &aMtrFldDrawX)
+ aMtrFldDrawY.SetValue( aMtrFldDrawX.GetValue() );
+ else
+ aMtrFldDrawX.SetValue( aMtrFldDrawY.GetValue() );
+ }
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ClickRotateHdl_Impl, void *, EMPTYARG )
+{
+ if( aCbxRotate.IsChecked() )
+ aMtrFldAngle.Enable();
+ else
+ aMtrFldAngle.Disable();
+
+ return( 0L );
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ChangeDivisionHdl_Impl, NumericField *, pField )
+{
+ bAttrModified = sal_True;
+ if( aCbxSynchronize.IsChecked() )
+ {
+ if(&aNumFldDivisionX == pField)
+ aNumFldDivisionY.SetValue( aNumFldDivisionX.GetValue() );
+ else
+ aNumFldDivisionX.SetValue( aNumFldDivisionY.GetValue() );
+ }
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK( SvxGridTabPage, ChangeGridsnapHdl_Impl, void *, EMPTYARG )
+{
+ bAttrModified = sal_True;
+ return 0;
+}
+
+
diff --git a/svx/source/dialog/optgrid.hrc b/svx/source/dialog/optgrid.hrc
new file mode 100644
index 000000000000..ced9bee740ca
--- /dev/null
+++ b/svx/source/dialog/optgrid.hrc
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_OPTGRID_HRC
+#define _SVX_OPTGRID_HRC
+
+//Grid-Page
+#define MTR_FLD_GRID 1
+#define GRP_DRAWGRID 2
+#define GRP_SNAPGRID 3
+#define CBX_USE_GRIDSNAP 4
+#define CBX_SYNCHRONIZE 5
+#define CBX_EQUAL_GRID 6
+#define CBX_SNAPGRID 7
+#define CBX_GRID_VISIBLE 8
+#define MTR_FLD_DRAW_Y 9
+#define MTR_FLD_SNAP_X 10
+#define MTR_FLD_SNAP_Y 11
+#define MTR_FLD_DRAW_X 12
+#define NUM_FLD_DIVISION_X 13
+#define NUM_FLD_DIVISION_Y 14
+#define FT_SNAP_X 15
+#define FT_SNAP_Y 16
+#define FT_DRAW_X 17
+#define FT_DRAW_Y 18
+#define FL_RESOLUTION 19
+#define FL_DIVISION 20
+#define FT_VERT_POINTS 21
+#define FT_HORZ_POINTS 22
+#define FT_DIVISION_Y 23
+#define FT_DIVISION_X 24
+#define CBX_SNAP_HELPLINES 25
+#define CBX_SNAP_BORDER 26
+#define CBX_SNAP_FRAME 27
+#define CBX_SNAP_POINTS 28
+#define FT_SNAP_AREA 29
+#define MTR_FLD_SNAP_AREA 30
+#define GRP_SNAP 31
+#define CBX_ORTHO 32
+#define CBX_BIGORTHO 33
+#define CBX_ROTATE 34
+#define MTR_FLD_ANGLE 35
+#define FT_BEZ_ANGLE 36
+#define MTR_FLD_BEZ_ANGLE 37
+#define GRP_ORTHO 38
+#define FL_SEPARATOR 39
+
+#endif
diff --git a/svx/source/dialog/optgrid.src b/svx/source/dialog/optgrid.src
new file mode 100644
index 000000000000..0d65c63f5d2f
--- /dev/null
+++ b/svx/source/dialog/optgrid.src
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <sfx2/sfx.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+#include "optgrid.hrc"
+ // pragma ----------------------------------------------------------------
+
+TabPage RID_SVXPAGE_GRID
+{
+ HelpId = HID_OPTIONS_GRID ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine GRP_DRAWGRID
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Grid" ;
+ };
+ CheckBox CBX_USE_GRIDSNAP
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_USE_GRIDSNAP";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sn~ap to grid" ;
+ };
+ CheckBox CBX_GRID_VISIBLE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_GRID_VISIBLE";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 204 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "V~isible grid" ;
+ };
+ FixedLine FL_RESOLUTION
+ {
+ Pos = MAP_APPFONT ( 6 , 45 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Resolution" ;
+ };
+ FixedText FT_DRAW_X
+ {
+ Pos = MAP_APPFONT ( 12 , 56 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "H~orizontal";
+ };
+ FixedText FT_DRAW_Y
+ {
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Vertical";
+ };
+ MetricField MTR_FLD_DRAW_X
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_DRAW_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 54 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ First = 10 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ MetricField MTR_FLD_DRAW_Y
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_DRAW_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 69 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 10 ;
+ First = 10 ;
+ Maximum = 10000 ;
+ Last = 10000 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ SpinSize = 50 ;
+ };
+ FixedLine FL_DIVISION
+ {
+ Pos = MAP_APPFONT ( 130 , 45 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Subdivision" ;
+ };
+ FixedText FT_DIVISION_X
+ {
+ Pos = MAP_APPFONT ( 136 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Horizont~al";
+ };
+ FixedText FT_DIVISION_Y
+ {
+ Pos = MAP_APPFONT ( 136 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "V~ertical";
+ };
+ NumericField NUM_FLD_DIVISION_X
+ {
+ HelpID = "svx:NumericField:RID_SVXPAGE_GRID:NUM_FLD_DIVISION_X";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 54 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Last = 99 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_HORZ_POINTS
+ {
+ Pos = MAP_APPFONT ( 223 , 56 ) ;
+ Size = MAP_APPFONT ( 29 , 8 ) ;
+ Text [ en-US ] = "space(s)" ;
+ };
+ NumericField NUM_FLD_DIVISION_Y
+ {
+ HelpID = "svx:NumericField:RID_SVXPAGE_GRID:NUM_FLD_DIVISION_Y";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 69 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Last = 99 ;
+ StrictFormat = TRUE ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_VERT_POINTS
+ {
+ Pos = MAP_APPFONT ( 223 , 71 ) ;
+ Size = MAP_APPFONT ( 29 , 8 ) ;
+
+ };
+ CheckBox CBX_SYNCHRONIZE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SYNCHRONIZE";
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 127 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Synchronize a~xes" ;
+ };
+ FixedLine GRP_SNAP
+ {
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Snap" ;
+ };
+
+ CheckBox CBX_SNAP_HELPLINES
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_HELPLINES";
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To snap lines" ;
+ };
+ CheckBox CBX_SNAP_BORDER
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_BORDER";
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 125 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Text [ en-US ] = "To the ~page margins" ;
+ };
+ CheckBox CBX_SNAP_FRAME
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_FRAME";
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To object ~frame" ;
+ };
+ CheckBox CBX_SNAP_POINTS
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_SNAP_POINTS";
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 106 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "To obje~ct points" ;
+ };
+ FixedText FT_SNAP_AREA
+ {
+ Pos = MAP_APPFONT ( 12 , 169 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Snap range" ;
+ };
+ MetricField MTR_FLD_SNAP_AREA
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_SNAP_AREA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 167 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 50 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ First = 1 ;
+ Last = 999 ;
+ CustomUnitText [ en-US ] = " Pixels" ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 127 , 111 ) ;
+ Size = MAP_APPFONT ( 4 , 68 ) ;
+ Hide = TRUE;
+ Vert = TRUE;
+ };
+ FixedLine GRP_ORTHO
+ {
+ Pos = MAP_APPFONT ( 130 , 100 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Snap position" ;
+ };
+ CheckBox CBX_ORTHO
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_ORTHO";
+ Pos = MAP_APPFONT ( 136 , 111 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~When creating or moving objects" ;
+ };
+ CheckBox CBX_BIGORTHO
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_BIGORTHO";
+ Pos = MAP_APPFONT ( 136 , 125 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Extend edges" ;
+ };
+ CheckBox CBX_ROTATE
+ {
+ HelpID = "svx:CheckBox:RID_SVXPAGE_GRID:CBX_ROTATE";
+ Pos = MAP_APPFONT ( 136 , 139 ) ;
+ // 136, 111
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "When ro~tating" ;
+ };
+ MetricField MTR_FLD_ANGLE
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 194 , 137 ) ;
+ // 190, 111
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 18000 ;
+ Last = 18000 ;
+ DecimalDigits = 2 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 500 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+ FixedText FT_BEZ_ANGLE
+ {
+ Pos = MAP_APPFONT ( 136 , 156 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Point reducti~on" ;
+ };
+ MetricField MTR_FLD_BEZ_ANGLE
+ {
+ HelpID = "svx:MetricField:RID_SVXPAGE_GRID:MTR_FLD_BEZ_ANGLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 194 , 154 ) ;
+ Size = MAP_APPFONT ( 54 , 12 ) ;
+ Hide = TRUE;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9000 ;
+ Last = 9000 ;
+ DecimalDigits = 2 ;
+ StrictFormat = TRUE ;
+ Unit = FUNIT_CUSTOM ;
+ SpinSize = 500 ;
+ CustomUnitText [ en-US ] = " degrees" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx
new file mode 100644
index 000000000000..95b6e5b4ca08
--- /dev/null
+++ b/svx/source/dialog/orienthelper.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/orienthelper.hxx"
+
+#include <vector>
+#include <utility>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include "svx/dialcontrol.hxx"
+
+namespace svx {
+
+// ============================================================================
+
+struct OrientationHelper_Impl
+{
+ typedef std::pair< Window*, TriState > WindowPair;
+ typedef std::vector< WindowPair > WindowVec;
+
+ DialControl& mrCtrlDial;
+ CheckBox& mrCbStacked;
+ WindowVec maWinVec;
+ bool mbEnabled;
+ bool mbVisible;
+
+ explicit OrientationHelper_Impl( DialControl& rCtrlDial, CheckBox& rCbStacked );
+
+ void AddDependentWindow( Window& rWindow, TriState eDisableIfStacked );
+
+ void EnableDependentWindows();
+ void EnableWindow( Window& rWindow, TriState eDisableIfStacked );
+
+ void ShowDependentWindows();
+
+ DECL_LINK( ClickHdl, void* );
+};
+
+// ----------------------------------------------------------------------------
+
+OrientationHelper_Impl::OrientationHelper_Impl( DialControl& rCtrlDial, CheckBox& rCbStacked ) :
+ mrCtrlDial( rCtrlDial ),
+ mrCbStacked( rCbStacked ),
+ mbEnabled( rCtrlDial.IsEnabled() ),
+ mbVisible( rCtrlDial.IsVisible() )
+{
+ maWinVec.push_back( WindowPair( &mrCtrlDial, STATE_CHECK ) );
+ maWinVec.push_back( WindowPair( &mrCbStacked, STATE_DONTKNOW ) );
+ mrCbStacked.SetClickHdl( LINK( this, OrientationHelper_Impl, ClickHdl ) );
+}
+
+void OrientationHelper_Impl::AddDependentWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ maWinVec.push_back( std::make_pair( &rWindow, eDisableIfStacked ) );
+ EnableWindow( rWindow, eDisableIfStacked );
+}
+
+void OrientationHelper_Impl::EnableDependentWindows()
+{
+ for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+ EnableWindow( *aIt->first, aIt->second );
+}
+
+void OrientationHelper_Impl::EnableWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ bool bDisableOnStacked = false;
+ switch( eDisableIfStacked )
+ {
+ // STATE_CHECK: Disable window, if stacked text is turned on or "don't know".
+ case STATE_CHECK: bDisableOnStacked = (mrCbStacked.GetState() != STATE_NOCHECK); break;
+ // STATE_NOCHECK: Disable window, if stacked text is turned off or "don't know".
+ case STATE_NOCHECK: bDisableOnStacked = (mrCbStacked.GetState() != STATE_CHECK); break;
+ default: ;//prevent warning
+ }
+ rWindow.Enable( mbEnabled && !bDisableOnStacked );
+}
+
+void OrientationHelper_Impl::ShowDependentWindows()
+{
+ for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+ aIt->first->Show( mbVisible );
+}
+
+IMPL_LINK( OrientationHelper_Impl, ClickHdl, void*, EMPTYARG )
+{
+ EnableDependentWindows();
+ return 0L;
+}
+
+// ============================================================================
+
+OrientationHelper::OrientationHelper( DialControl& rCtrlDial, CheckBox& rCbStacked ) :
+ mpImpl( new OrientationHelper_Impl( rCtrlDial, rCbStacked ) )
+{
+ mpImpl->EnableDependentWindows();
+ mpImpl->ShowDependentWindows();
+}
+
+OrientationHelper::OrientationHelper( DialControl& rCtrlDial, NumericField& rNfRotation, CheckBox& rCbStacked ) :
+ mpImpl( new OrientationHelper_Impl( rCtrlDial, rCbStacked ) )
+{
+ rCtrlDial.SetLinkedField( &rNfRotation );
+ mpImpl->EnableDependentWindows();
+ mpImpl->ShowDependentWindows();
+}
+
+OrientationHelper::~OrientationHelper()
+{
+}
+
+void OrientationHelper::AddDependentWindow( Window& rWindow, TriState eDisableIfStacked )
+{
+ mpImpl->AddDependentWindow( rWindow, eDisableIfStacked );
+}
+
+void OrientationHelper::Enable( bool bEnable )
+{
+ mpImpl->mbEnabled = bEnable;
+ mpImpl->EnableDependentWindows();
+}
+
+void OrientationHelper::Show( bool bShow )
+{
+ mpImpl->mbVisible = bShow;
+ mpImpl->ShowDependentWindows();
+}
+
+void OrientationHelper::SetStackedState( TriState eState )
+{
+ if( eState != GetStackedState() )
+ {
+ mpImpl->mrCbStacked.SetState( eState );
+ mpImpl->EnableDependentWindows();
+ }
+}
+
+TriState OrientationHelper::GetStackedState() const
+{
+ return mpImpl->mrCbStacked.GetState();
+}
+
+void OrientationHelper::EnableStackedTriState( bool bEnable )
+{
+ mpImpl->mrCbStacked.EnableTriState( bEnable );
+}
+
+// ============================================================================
+
+OrientStackedWrapper::OrientStackedWrapper( OrientationHelper& rOrientHlp ) :
+ SingleControlWrapperType( rOrientHlp )
+{
+}
+
+bool OrientStackedWrapper::IsControlDontKnow() const
+{
+ return GetControl().GetStackedState() == STATE_DONTKNOW;
+}
+
+void OrientStackedWrapper::SetControlDontKnow( bool bSet )
+{
+ GetControl().EnableStackedTriState( bSet );
+ GetControl().SetStackedState( bSet ? STATE_DONTKNOW : STATE_NOCHECK );
+}
+
+bool OrientStackedWrapper::GetControlValue() const
+{
+ return GetControl().GetStackedState() == STATE_CHECK;
+}
+
+void OrientStackedWrapper::SetControlValue( bool bValue )
+{
+ GetControl().SetStackedState( bValue ? STATE_CHECK : STATE_NOCHECK );
+}
+
+// ============================================================================
+
+} // namespace svx
+
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
new file mode 100644
index 000000000000..e0c302da38df
--- /dev/null
+++ b/svx/source/dialog/pagectrl.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <vcl/bitmap.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/pageitem.hxx>
+#include <svx/pagectrl.hxx>
+#include <editeng/boxitem.hxx>
+
+#include <algorithm>
+
+// struct PageWindow_Impl ------------------------------------------------
+
+struct PageWindow_Impl
+{
+ SvxBoxItem* pBorder;
+ Bitmap aBitmap;
+ FASTBOOL bBitmap;
+ sal_Bool bResetBackground;
+ sal_Bool bFrameDirection;
+ sal_Int32 nFrameDirection;
+
+
+ PageWindow_Impl() :
+ pBorder(0),
+ bBitmap(sal_False),
+ bResetBackground(sal_False),
+ bFrameDirection(sal_False),
+ nFrameDirection(0) {}
+
+ void EnableFrameDirection(sal_Bool bEnable){bFrameDirection = bEnable;}
+ void SetFrameDirection(sal_Int32 nDirection){nFrameDirection = nDirection;}
+
+};
+
+// STATIC DATA -----------------------------------------------------------
+
+#define CELL_WIDTH 1600L
+#define CELL_HEIGHT 800L
+
+// class SvxPageWindow ---------------------------------------------------
+
+SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) :
+
+ Window( pParent, rId ),
+
+ nTop ( 0 ),
+ nBottom ( 0 ),
+ nLeft ( 0 ),
+ nRight ( 0 ),
+ aColor ( COL_TRANSPARENT ),
+ nHdLeft ( 0 ),
+ nHdRight ( 0 ),
+ nHdDist ( 0 ),
+ nHdHeight ( 0 ),
+ aHdColor ( COL_TRANSPARENT ),
+ pHdBorder ( 0 ),
+ nFtLeft ( 0 ),
+ nFtRight ( 0 ),
+ nFtDist ( 0 ),
+ nFtHeight ( 0 ),
+ aFtColor ( COL_TRANSPARENT ),
+ pFtBorder ( 0 ),
+ bFooter ( sal_False ),
+ bHeader ( sal_False ),
+ bTable ( sal_False ),
+ bHorz ( sal_False ),
+ bVert ( sal_False ),
+ eUsage ( SVX_PAGE_ALL )
+
+{
+ pImpl = new PageWindow_Impl;
+
+ // defaultmaessing in Twips rechnen
+ SetMapMode( MapMode( MAP_TWIP ) );
+ aWinSize = GetOutputSizePixel();
+ aWinSize.Height() -= 4;
+ aWinSize.Width() -= 4;
+
+ aWinSize = PixelToLogic( aWinSize );
+ SetBackground();
+}
+
+// -----------------------------------------------------------------------
+
+SvxPageWindow::~SvxPageWindow()
+{
+ delete pImpl;
+ delete pHdBorder;
+ delete pFtBorder;
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT SvxPageWindow::Paint( const Rectangle& )
+{
+ Fraction aXScale( aWinSize.Width(), std::max( (long) (aSize.Width() * 2 + aSize.Width() / 8), 1L ) );
+ Fraction aYScale( aWinSize.Height(), std::max( aSize.Height(), 1L ) );
+ MapMode aMapMode( GetMapMode() );
+
+ if ( aYScale < aXScale )
+ {
+ aMapMode.SetScaleX( aYScale );
+ aMapMode.SetScaleY( aYScale );
+ }
+ else
+ {
+ aMapMode.SetScaleX( aXScale );
+ aMapMode.SetScaleY( aXScale );
+ }
+ SetMapMode( aMapMode );
+ Size aSz( PixelToLogic( GetSizePixel() ) );
+ long nYPos = ( aSz.Height() - aSize.Height() ) / 2;
+
+ if ( eUsage == SVX_PAGE_ALL )
+ {
+ // alle Seiten gleich -> eine Seite malen
+ if ( aSize.Width() > aSize.Height() )
+ {
+ // Querformat in gleicher Gr"osse zeichnen
+ Fraction aX = aMapMode.GetScaleX();
+ Fraction aY = aMapMode.GetScaleY();
+ Fraction a2( 1.5 );
+ aX *= a2;
+ aY *= a2;
+ aMapMode.SetScaleX( aX );
+ aMapMode.SetScaleY( aY );
+ SetMapMode( aMapMode );
+ aSz = PixelToLogic( GetSizePixel() );
+ nYPos = ( aSz.Height() - aSize.Height() ) / 2;
+ long nXPos = ( aSz.Width() - aSize.Width() ) / 2;
+ DrawPage( Point( nXPos, nYPos ), sal_True, sal_True );
+ }
+ else
+ // Hochformat
+ DrawPage( Point( ( aSz.Width() - aSize.Width() ) / 2, nYPos ), sal_True, sal_True );
+ }
+ else
+ {
+ // Linke und rechte Seite unterschiedlich -> ggf. zwei Seiten malen
+ DrawPage( Point( 0, nYPos ), sal_False, (sal_Bool)( eUsage & SVX_PAGE_LEFT ) );
+ DrawPage( Point( aSize.Width() + aSize.Width() / 8, nYPos ), sal_True,
+ (sal_Bool)( eUsage & SVX_PAGE_RIGHT ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const sal_Bool bEnabled )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rFieldColor = rStyleSettings.GetFieldColor();
+ const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor();
+ const Color& rDisableColor = rStyleSettings.GetDisableColor();
+ const Color& rDlgColor = rStyleSettings.GetDialogColor();
+
+ // background
+ if(!bSecond || pImpl->bResetBackground)
+ {
+ SetLineColor( Color(COL_TRANSPARENT) );
+ SetFillColor( rDlgColor );
+ Size winSize(GetOutputSize());
+ DrawRect( Rectangle( Point(0,0), winSize ) );
+
+ if ( pImpl->bResetBackground )
+ pImpl->bResetBackground = sal_False;
+ }
+ SetLineColor( rFieldTextColor );
+ // Schatten
+ Size aTempSize = aSize;
+ // Seite
+ if ( !bEnabled )
+ {
+ SetFillColor( rDisableColor );
+ DrawRect( Rectangle( rOrg, aTempSize ) );
+ return;
+ }
+ SetFillColor( rFieldColor );
+ DrawRect( Rectangle( rOrg, aTempSize ) );
+
+ // Border Top Bottom Left Right
+ Point aBegin( rOrg );
+ Point aEnd( rOrg );
+
+ long nL = nLeft;
+ long nR = nRight;
+
+ if ( eUsage == SVX_PAGE_MIRROR && !bSecond )
+ {
+ // f"ur gespiegelt drehen
+ nL = nRight;
+ nR = nLeft;
+ }
+
+ Rectangle aRect;
+
+ aRect.Left() = rOrg.X() + nL;
+ aRect.Right() = rOrg.X() + aTempSize.Width() - nR;
+ aRect.Top() = rOrg.Y() + nTop;
+ aRect.Bottom()= rOrg.Y() + aTempSize.Height() - nBottom;
+
+ Rectangle aHdRect( aRect );
+ Rectangle aFtRect( aRect );
+
+ if ( bHeader )
+ {
+ // ggf. Header anzeigen
+ aHdRect.Left() += nHdLeft;
+ aHdRect.Right() -= nHdRight;
+ aHdRect.Bottom() = aRect.Top() + nHdHeight;
+ aRect.Top() += nHdHeight + nHdDist;
+ SetFillColor( aHdColor );
+ DrawRect( aHdRect );
+ }
+
+ if ( bFooter )
+ {
+ // ggf. Footer anzeigen
+ aFtRect.Left() += nFtLeft;
+ aFtRect.Right() -= nFtRight;
+ aFtRect.Top() = aRect.Bottom() - nFtHeight;
+ aRect.Bottom() -= nFtHeight + nFtDist;
+ SetFillColor( aFtColor );
+ DrawRect( aFtRect );
+ }
+
+ // Body malen
+ SetFillColor( aColor );
+ if ( pImpl->bBitmap )
+ {
+ DrawRect( aRect );
+ Point aBmpPnt = aRect.TopLeft();
+ Size aBmpSiz = aRect.GetSize();
+ long nDeltaX = aBmpSiz.Width() / 15;
+ long nDeltaY = aBmpSiz.Height() / 15;
+ aBmpPnt.X() += nDeltaX;
+ aBmpPnt.Y() += nDeltaY;
+ aBmpSiz.Width() -= nDeltaX * 2;
+ aBmpSiz.Height() -= nDeltaY * 2;
+ DrawBitmap( aBmpPnt, aBmpSiz, pImpl->aBitmap );
+ }
+ else
+ DrawRect( aRect );
+
+ if(pImpl->bFrameDirection && !bTable)
+ {
+ //pImpl->nFrameDirection
+ Point aPos;
+ Font aFont(GetFont());
+ const Size aSaveSize = aFont.GetSize();
+ Size aDrawSize( 0, aRect.GetHeight() / 6);
+ aFont.SetSize(aDrawSize);
+ SetFont(aFont);
+ String sText(String::CreateFromAscii("ABC"));
+ Point aMove(1, GetTextHeight());
+ sal_Unicode cArrow = 0x2193;
+ long nAWidth = GetTextWidth(String(sText.GetChar(0)));
+ switch(pImpl->nFrameDirection)
+ {
+ case FRMDIR_HORI_LEFT_TOP:
+ aPos = aRect.TopLeft();
+ aPos.X() += PixelToLogic(Point(1,1)).X();
+ aMove.Y() = 0;
+ cArrow = 0x2192;
+ break;
+ case FRMDIR_HORI_RIGHT_TOP:
+ aPos = aRect.TopRight();
+ aPos.X() -= nAWidth;
+ aMove.Y() = 0;
+ aMove.X() *= -1;
+ cArrow = 0x2190;
+ break;
+ case FRMDIR_VERT_TOP_LEFT:
+ aPos = aRect.TopLeft();
+ aPos.X() += PixelToLogic(Point(1,1)).X();
+ aMove.X() = 0;
+ break;
+ case FRMDIR_VERT_TOP_RIGHT:
+ aPos = aRect.TopRight();
+ aPos.X() -= nAWidth;
+ aMove.X() = 0;
+ break;
+ }
+ sText.Append(cArrow);
+ for(sal_uInt16 i = 0; i < sText.Len(); i++)
+ {
+ String sDraw(sText.GetChar(i));
+ long nHDiff = 0;
+ long nCharWidth = GetTextWidth(sDraw);
+ sal_Bool bHorizontal = 0 == aMove.Y();
+ if(!bHorizontal)
+ {
+ nHDiff = (nAWidth - nCharWidth)/2;
+ aPos.X() += nHDiff;
+ }
+ DrawText(aPos, sDraw);
+ if(bHorizontal)
+ {
+ aPos.X() += aMove.X() < 0 ? - nCharWidth : nCharWidth;
+ }
+ else
+ {
+ aPos.X() -= nHDiff;
+ aPos.Y() += aMove.Y();
+ }
+ }
+ aFont.SetSize(aSaveSize);
+ SetFont(aFont);
+
+ }
+ if ( bTable )
+ {
+ // Tabelle malen, ggf. zentrieren
+ SetLineColor( Color(COL_LIGHTGRAY) );
+
+ long nW = aRect.GetWidth(), nH = aRect.GetHeight();
+ long nTW = CELL_WIDTH * 3, nTH = CELL_HEIGHT * 3;
+ long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left();
+ long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top();
+ Rectangle aCellRect( Point( _nLeft, _nTop ), Size( CELL_WIDTH, CELL_HEIGHT ) );
+
+ for ( sal_uInt16 i = 0; i < 3; ++i )
+ {
+ aCellRect.Left() = _nLeft;
+ aCellRect.Right() = _nLeft + CELL_WIDTH;
+ if ( i > 0 )
+ aCellRect.Move( 0, CELL_HEIGHT );
+
+ for ( sal_uInt16 j = 0; j < 3; ++j )
+ {
+ if ( j > 0 )
+ aCellRect.Move( CELL_WIDTH, 0 );
+ DrawRect( aCellRect );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetBorder( const SvxBoxItem& rNew )
+{
+ delete pImpl->pBorder;
+ pImpl->pBorder = new SvxBoxItem( rNew );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetBitmap( Bitmap* pBmp )
+{
+ if ( pBmp )
+ {
+ pImpl->aBitmap = *pBmp;
+ pImpl->bBitmap = sal_True;
+ }
+ else
+ pImpl->bBitmap = sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetHdBorder( const SvxBoxItem& rNew )
+{
+ delete pHdBorder;
+ pHdBorder = new SvxBoxItem( rNew );
+}
+// -----------------------------------------------------------------------
+
+void SvxPageWindow::SetFtBorder( const SvxBoxItem& rNew )
+{
+ delete pFtBorder;
+ pFtBorder = new SvxBoxItem( rNew );
+}
+/* -----------------------------13.06.2002 16:16------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable)
+{
+ pImpl->EnableFrameDirection(bEnable);
+}
+/* -----------------------------13.06.2002 16:16------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxPageWindow::SetFrameDirection(sal_Int32 nFrameDirection)
+{
+ pImpl->SetFrameDirection(nFrameDirection);
+}
+
+void SvxPageWindow::ResetBackground()
+{
+ pImpl->bResetBackground = sal_True;
+}
diff --git a/svx/source/dialog/paraprev.cxx b/svx/source/dialog/paraprev.cxx
new file mode 100644
index 000000000000..2e9283b1c15d
--- /dev/null
+++ b/svx/source/dialog/paraprev.cxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <svx/paraprev.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+#define FOUR_POINTS 80
+
+// class SvxParaPrevWindow -----------------------------------------------
+
+SvxParaPrevWindow::SvxParaPrevWindow( Window* pParent, const ResId& rId ) :
+
+ Window( pParent, rId ),
+
+ nLeftMargin ( 0 ),
+ nRightMargin ( 0 ),
+ nFirstLineOfst ( 0 ),
+ nUpper ( 0 ),
+ nLower ( 0 ),
+ eAdjust ( SVX_ADJUST_LEFT ),
+ eLastLine ( SVX_ADJUST_LEFT ),
+ eLine ( SVX_PREV_LINESPACE_1 ),
+ nLineVal ( 0 )
+
+{
+ // defaultmaessing in Twips rechnen
+ SetMapMode( MapMode( MAP_TWIP ) );
+ aWinSize = GetOutputSizePixel();
+ aWinSize = PixelToLogic( aWinSize );
+ Size aTmp(1, 1);
+ aTmp = PixelToLogic(aTmp);
+ aWinSize.Width() -= aTmp.Width() /2;
+ aWinSize.Height() -= aTmp.Height() /2;
+
+ aSize = Size( 11905, 16837 );
+
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxParaPrevWindow::Paint( const Rectangle& )
+{
+ DrawParagraph( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+#define DEF_MARGIN 120
+
+void SvxParaPrevWindow::DrawParagraph( sal_Bool bAll )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rWinColor = rStyleSettings.GetWindowColor();
+ Color aGrayColor(COL_LIGHTGRAY);
+
+ SetFillColor( Color( rWinColor ) );
+ if( bAll )
+ DrawRect( Rectangle( Point(), aWinSize ) );
+
+ SetLineColor();
+
+ long nH = aWinSize.Height() / 19;
+ Size aLineSiz( aWinSize.Width() - DEF_MARGIN, nH ),
+ aSiz = aLineSiz;
+ Point aPnt;
+ aPnt.X() = DEF_MARGIN / 2;
+ SetFillColor( aGrayColor );
+
+ for ( sal_uInt16 i = 0; i < 9; ++i )
+ {
+ if ( 3 == i )
+ {
+ SetFillColor( Color( COL_GRAY ) );
+ long nTop = nUpper * aLineSiz.Height() / aSize.Height();
+ aPnt.Y() += nTop * 2;
+ }
+
+ if ( 6 == i )
+ SetFillColor( aGrayColor );
+
+ if ( 3 <= i && 6 > i )
+ {
+ long nLeft = nLeftMargin * aLineSiz.Width() / aSize.Width();
+ long nFirst = nFirstLineOfst * aLineSiz.Width() / aSize.Width();
+ long nTmp = nLeft + nFirst;
+
+ if ( 3 == i )
+ {
+ aPnt.X() += nTmp;
+ aSiz.Width() -= nTmp;
+ }
+ else
+ {
+ aPnt.X() += nLeft;
+ aSiz.Width() -= nLeft;
+ }
+ long nRight = nRightMargin * aLineSiz.Width() / aSize.Width();
+ aSiz.Width() -= nRight;
+ }
+
+ if ( 4 == i || 5 == i || 6 == i )
+ {
+ switch ( eLine )
+ {
+ case SVX_PREV_LINESPACE_1: break;
+ case SVX_PREV_LINESPACE_15: aPnt.Y() += nH / 2; break;
+ case SVX_PREV_LINESPACE_2: aPnt.Y() += nH; break;
+
+ case SVX_PREV_LINESPACE_PROP:
+ case SVX_PREV_LINESPACE_MIN:
+ case SVX_PREV_LINESPACE_DURCH: break;
+ }
+ }
+
+ aPnt.Y() += nH;
+
+ if ( (3 <= i) && (5 >= i) )
+ {
+ long nLW;
+ switch( i )
+ {
+ default:
+ case 3: nLW = aLineSiz.Width() * 8 / 10; break;
+ case 4: nLW = aLineSiz.Width() * 9 / 10; break;
+ case 5: nLW = aLineSiz.Width() / 2; break;
+ }
+
+ if ( nLW > aSiz.Width() )
+ nLW = aSiz.Width();
+
+ switch ( eAdjust )
+ {
+ case SVX_ADJUST_LEFT:
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPnt.X() += ( aSiz.Width() - nLW );
+ break;
+ case SVX_ADJUST_CENTER:
+ aPnt.X() += ( aSiz.Width() - nLW ) / 2;
+ break;
+ default: ; //prevent warning
+ }
+ if( SVX_ADJUST_BLOCK == eAdjust )
+ {
+ if( 5 == i )
+ {
+ switch( eLastLine )
+ {
+ case SVX_ADJUST_LEFT:
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPnt.X() += ( aSiz.Width() - nLW );
+ break;
+ case SVX_ADJUST_CENTER:
+ aPnt.X() += ( aSiz.Width() - nLW ) / 2;
+ break;
+ case SVX_ADJUST_BLOCK:
+ nLW = aSiz.Width();
+ break;
+ default: ; //prevent warning
+ }
+ }
+ else
+ nLW = aSiz.Width();
+ }
+ aSiz.Width() = nLW;
+ }
+
+ Rectangle aRect( aPnt, aSiz );
+
+ if ( Lines[i] != aRect || bAll )
+ {
+ if ( !bAll )
+ {
+ Color aFillCol = GetFillColor();
+ SetFillColor( rWinColor );
+ DrawRect( Lines[i] );
+ SetFillColor( aFillCol );
+ }
+ DrawRect( aRect );
+ Lines[i] = aRect;
+ }
+
+ if ( 5 == i )
+ {
+ long nBottom = nLower * aLineSiz.Height() / aSize.Height();
+ aPnt.Y() += nBottom * 2;
+ }
+
+ aPnt.Y() += nH;
+ // wieder zuruecksetzen, fuer jede Linie neu berechnen
+ aPnt.X() = DEF_MARGIN / 2;
+ aSiz = aLineSiz;
+ }
+}
+
+#undef DEF_MARGIN
+
+// -----------------------------------------------------------------------
+
+void SvxParaPrevWindow::OutputSizeChanged()
+{
+ aWinSize = GetOutputSizePixel();
+ aWinSize = PixelToLogic( aWinSize );
+ Invalidate();
+}
+
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx
new file mode 100644
index 000000000000..2a107d9e23af
--- /dev/null
+++ b/svx/source/dialog/passwd.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/shl.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#define _SVX_PASSWD_CXX
+
+#include "svx/passwd.hxx"
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include "passwd.hrc"
+
+// class SvxPasswordDialog -----------------------------------------------
+
+IMPL_LINK( SvxPasswordDialog, ButtonHdl, OKButton *, EMPTYARG )
+{
+ sal_Bool bOK = sal_True;
+ short nRet = RET_OK;
+ String aEmpty;
+
+ if ( aNewPasswdED.GetText() != aRepeatPasswdED.GetText() )
+ {
+ ErrorBox( this, WB_OK, aRepeatPasswdErrStr ).Execute();
+ aNewPasswdED.SetText( aEmpty );
+ aRepeatPasswdED.SetText( aEmpty );
+ aNewPasswdED.GrabFocus();
+ bOK = sal_False;
+ }
+
+ if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
+ {
+ ErrorBox( this, WB_OK, aOldPasswdErrStr ).Execute();
+ aOldPasswdED.SetText( aEmpty );
+ aOldPasswdED.GrabFocus();
+ bOK = sal_False;
+ }
+
+ if ( bOK )
+ EndDialog( nRet );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
+{
+ if ( !bEmpty )
+ {
+ String aPasswd = aRepeatPasswdED.GetText();
+ aPasswd.EraseLeadingChars().EraseTrailingChars();
+
+ if ( !aPasswd.Len() && aOKBtn.IsEnabled() )
+ aOKBtn.Disable();
+ else if ( aPasswd.Len() && !aOKBtn.IsEnabled() )
+ aOKBtn.Enable();
+ }
+ else if ( !aOKBtn.IsEnabled() )
+ aOKBtn.Enable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SvxPasswordDialog::SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword ) :
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_PASSWORD ) ),
+ aOldFL ( this, SVX_RES( FL_OLD_PASSWD ) ),
+ aOldPasswdFT ( this, SVX_RES( FT_OLD_PASSWD ) ),
+ aOldPasswdED ( this, SVX_RES( ED_OLD_PASSWD ) ),
+ aNewFL ( this, SVX_RES( FL_NEW_PASSWD ) ),
+ aNewPasswdFT ( this, SVX_RES( FT_NEW_PASSWD ) ),
+ aNewPasswdED ( this, SVX_RES( ED_NEW_PASSWD ) ),
+ aRepeatPasswdFT ( this, SVX_RES( FT_REPEAT_PASSWD ) ),
+ aRepeatPasswdED ( this, SVX_RES( ED_REPEAT_PASSWD ) ),
+ aOKBtn ( this, SVX_RES( BTN_PASSWD_OK ) ),
+ aEscBtn ( this, SVX_RES( BTN_PASSWD_ESC ) ),
+ aHelpBtn ( this, SVX_RES( BTN_PASSWD_HELP ) ),
+ aOldPasswdErrStr ( SVX_RES( STR_ERR_OLD_PASSWD ) ),
+ aRepeatPasswdErrStr ( SVX_RES( STR_ERR_REPEAT_PASSWD ) ),
+ bEmpty ( bAllowEmptyPasswords )
+{
+ FreeResource();
+
+ aOKBtn.SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
+ aRepeatPasswdED.SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
+ EditModifyHdl( 0 );
+
+ if ( bDisableOldPassword )
+ {
+ aOldFL.Disable();
+ aOldPasswdFT.Disable();
+ aOldPasswdED.Disable();
+ aNewPasswdED.GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvxPasswordDialog::~SvxPasswordDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+
+
diff --git a/svx/source/dialog/passwd.hrc b/svx/source/dialog/passwd.hrc
new file mode 100644
index 000000000000..337990a952e6
--- /dev/null
+++ b/svx/source/dialog/passwd.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_PASSWD_HRC
+#define _SVX_PASSWD_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_OLD_PASSWD 10
+#define ED_OLD_PASSWD 11
+#define FL_OLD_PASSWD 12
+
+#define FT_NEW_PASSWD 20
+#define ED_NEW_PASSWD 21
+#define FT_REPEAT_PASSWD 22
+#define ED_REPEAT_PASSWD 23
+#define FL_NEW_PASSWD 24
+
+#define BTN_PASSWD_OK 30
+#define BTN_PASSWD_ESC 31
+#define BTN_PASSWD_HELP 32
+
+#define STR_ERR_OLD_PASSWD 40
+#define STR_ERR_REPEAT_PASSWD 41
+
+
+#endif
+
diff --git a/svx/source/dialog/passwd.src b/svx/source/dialog/passwd.src
new file mode 100644
index 000000000000..821ede7c9357
--- /dev/null
+++ b/svx/source/dialog/passwd.src
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include <svx/dialogs.hrc>
+#include "helpid.hrc"
+#include "passwd.hrc"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_PASSWORD ---------------------------------------------------
+ModalDialog RID_SVXDLG_PASSWORD
+{
+ HelpId = HID_PASSWORD ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 210 , 77 ) ;
+ Moveable = TRUE ;
+ FixedText FT_OLD_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "~Password" ;
+ };
+ Edit ED_OLD_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_OLD_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 14 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedLine FL_OLD_PASSWD
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 142 , 8 ) ;
+ Text [ en-US ] = "Old password" ;
+ };
+ FixedText FT_NEW_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Pa~ssword" ;
+ };
+ Edit ED_NEW_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_NEW_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 43 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedText FT_REPEAT_PASSWD
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "Confi~rm";
+ };
+ Edit ED_REPEAT_PASSWD
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_REPEAT_PASSWD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 71 , 59 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ PassWord = TRUE ;
+ };
+ FixedLine FL_NEW_PASSWD
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 142 , 8 ) ;
+ Text [ en-US ] = "New password" ;
+ };
+ OKButton BTN_PASSWD_OK
+ {
+ Pos = MAP_APPFONT ( 154 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ Disable = TRUE ;
+ };
+ CancelButton BTN_PASSWD_ESC
+ {
+ Pos = MAP_APPFONT ( 154 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_PASSWD_HELP
+ {
+ Pos = MAP_APPFONT ( 154 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String STR_ERR_OLD_PASSWD
+ {
+ Text [ en-US ] = "Invalid password" ;
+ };
+ String STR_ERR_REPEAT_PASSWD
+ {
+ Text [ en-US ] = "Passwords do not match" ;
+ };
+ Text [ en-US ] = "Change Password" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/pfiledlg.cxx b/svx/source/dialog/pfiledlg.cxx
new file mode 100644
index 000000000000..2938988fac7e
--- /dev/null
+++ b/svx/source/dialog/pfiledlg.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <sfx2/docfile.hxx>
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#include <com/sun/star/plugin/XPluginManager.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include "svx/pfiledlg.hxx"
+#include <svx/dialogs.hrc>
+
+#include <svx/dialmgr.hxx>
+#include <list>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+sal_Char __READONLY_DATA sAudio[] = "audio";
+sal_Char __READONLY_DATA sVideo[] = "video";
+
+/*************************************************************************
+|*
+|* Filedialog to insert Plugin-Fileformats
+|*
+\************************************************************************/
+
+ErrCode SvxPluginFileDlg::Execute()
+{
+ return maFileDlg.Execute();
+}
+
+String SvxPluginFileDlg::GetPath() const
+{
+ return maFileDlg.GetPath();
+}
+
+SvxPluginFileDlg::SvxPluginFileDlg (Window *, sal_uInt16 nKind ) :
+ maFileDlg(SFXWB_INSERT)
+{
+ // set title of the dialogwindow
+ switch (nKind)
+ {
+ case SID_INSERT_SOUND :
+ {
+ maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_SOUND_TITLE));
+ }
+ break;
+ case SID_INSERT_VIDEO :
+ {
+ maFileDlg.SetTitle(SVX_RESSTR(STR_INSERT_VIDEO_TITLE));
+ }
+ break;
+ }
+
+ // fill the filterlist of the filedialog with data of installed plugins
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ uno::Reference< plugin::XPluginManager > rPluginManager( xMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), uno::UNO_QUERY );
+ if ( rPluginManager.is() )
+ {
+ const uno::Sequence<plugin::PluginDescription > aSeq( rPluginManager->getPluginDescriptions() );
+ const plugin::PluginDescription* pDescription = aSeq.getConstArray();
+ sal_Int32 nAnzahlPlugins = rPluginManager->getPluginDescriptions().getLength();
+
+ std::list< String > aPlugNames;
+ std::list< String > aPlugExtensions;
+ std::list< String >::iterator j;
+ std::list< String >::iterator k;
+ std::list< String >::const_iterator end;
+
+ for ( int i = 0; i < nAnzahlPlugins; i++ )
+ {
+ String aStrPlugMIMEType( pDescription[i].Mimetype );
+ String aStrPlugName( pDescription[i].Description );
+ String aStrPlugExtension( pDescription[i].Extension );
+
+ aStrPlugMIMEType.ToLowerAscii();
+ aStrPlugExtension.ToLowerAscii();
+
+ if ( ( nKind == SID_INSERT_SOUND && aStrPlugMIMEType.SearchAscii ( sAudio ) == 0 ) ||
+ ( nKind == SID_INSERT_VIDEO && aStrPlugMIMEType.SearchAscii ( sVideo ) == 0 ) )
+ {
+ // extension already in the filterlist of the filedlg ?
+ sal_Bool bAlreadyExist = sal_False;
+ for ( j = aPlugExtensions.begin(), end = aPlugExtensions.end(); j != end && !bAlreadyExist; ++j )
+ {
+ bAlreadyExist = (j->Search( aStrPlugExtension ) != STRING_NOTFOUND );
+ }
+
+ if ( !bAlreadyExist )
+ {
+ // filterdescription already there?
+ // (then append the new extension to the existing filter)
+ int nfound = -1;
+ for ( j = aPlugNames.begin(),
+ k = aPlugExtensions.begin(),
+ end = aPlugNames.end();
+ j != end && nfound != 0; )
+ {
+ if ( ( nfound = j->Search( aStrPlugName ) ) == 0 )
+ {
+ if ( aStrPlugExtension.Len() > 0 )
+ aStrPlugExtension.Insert( sal_Unicode( ';' ) );
+ aStrPlugExtension.Insert( *k );
+
+ // remove old entry, increment (iterators are invalid thereafter, thus the postincrement)
+ aPlugNames.erase(j++); aPlugExtensions.erase(k++);
+
+ // update end iterator (which may be invalid, too!)
+ end = aPlugNames.end();
+ }
+ else
+ {
+ // next element
+ ++j; ++k;
+ }
+ }
+
+ // build filterdescription
+ aStrPlugName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) );
+ aStrPlugName.Append( aStrPlugExtension );
+ aStrPlugName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) );
+
+ // use a own description for the video-formate avi, mov and mpeg
+ // the descriptions of these MIME-types are not very meaningful
+ const sal_Char sAVI[] = "*.avi";
+ const sal_Char sMOV[] = "*.mov";
+ const sal_Char sMPG[] = "*.mpg";
+ const sal_Char sMPE[] = "*.mpe";
+ const sal_Char sMPEG[] = "*.mpeg";
+
+ if ( aStrPlugExtension.EqualsIgnoreCaseAscii( sAVI ) )
+ aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_AVI );
+ else if ( aStrPlugExtension.EqualsIgnoreCaseAscii( sMOV ) )
+ aStrPlugName = SVX_RESSTR( STR_INSERT_VIDEO_EXTFILTER_MOV );
+ else if ( aStrPlugExtension.SearchAscii( sMPG ) != STRING_NOTFOUND ||
+ aStrPlugExtension.SearchAscii( sMPE ) != STRING_NOTFOUND ||
+ aStrPlugExtension.SearchAscii( sMPEG ) != STRING_NOTFOUND )
+ aStrPlugName = SVX_RESSTR(STR_INSERT_VIDEO_EXTFILTER_MPEG);
+
+ aPlugNames.push_back( aStrPlugName );
+ aPlugExtensions.push_back( aStrPlugExtension );
+ }
+ }
+ }
+
+ // add filter to dialog
+ for ( j = aPlugNames.begin(),
+ k = aPlugExtensions.begin(),
+ end = aPlugNames.end();
+ j != end; ++j, ++k )
+ {
+ maFileDlg.AddFilter( *j, *k );
+ }
+ }
+ }
+
+ // add the All-Filter
+ String aAllFilter( ResId( STR_EXTFILTER_ALL, DIALOG_MGR() ) );
+ maFileDlg.AddFilter( aAllFilter, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) );
+
+ // and activate him
+ maFileDlg.SetCurrentFilter( aAllFilter );
+}
+
+/*************************************************************************
+|*
+|* Dtor
+|*
+\************************************************************************/
+
+SvxPluginFileDlg::~SvxPluginFileDlg()
+{
+}
+
+/*************************************************************************
+|*
+|* Plugins available for the the MIME-Typ in nKind
+|* (whith nKind = SID_INSERT_SOUND for MIME-Type audio
+|* SID_INSERT_VIDEO for MIME-Type video
+|*
+\************************************************************************/
+
+#define PFDLG_CHECKED_SOUND 0x0001
+#define PFDLG_CHECKED_VIDEO 0x0002
+#define PFDLG_FOUND_SOUND 0x0004
+#define PFDLG_FOUND_VIDEO 0x0008
+
+bool SvxPluginFileDlg::IsAvailable (sal_uInt16 nKind)
+{
+ static sal_uInt16 nCheck = 0;
+
+ if ( nKind == SID_INSERT_SOUND && ( nCheck & PFDLG_CHECKED_SOUND ) )
+ return (nCheck & PFDLG_FOUND_SOUND) != 0;
+ if ( nKind == SID_INSERT_VIDEO && ( nCheck & PFDLG_CHECKED_VIDEO ) )
+ return (nCheck & PFDLG_FOUND_VIDEO) != 0;
+
+ bool bFound = false;
+ uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ uno::Reference< plugin::XPluginManager > rPluginManager = uno::Reference< plugin::XPluginManager > ( xMgr->createInstance( OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), uno::UNO_QUERY );
+ if( rPluginManager.is() )
+ {
+ const uno::Sequence<plugin::PluginDescription > aSeq( rPluginManager->getPluginDescriptions() );
+ const plugin::PluginDescription* pDescription = aSeq.getConstArray();
+ sal_Int32 nAnzahlPlugins = rPluginManager->getPluginDescriptions().getLength();
+
+ for ( sal_uInt16 i = 0; i < nAnzahlPlugins && !bFound; ++i )
+ {
+ String aStrPlugMIMEType( pDescription[i].Mimetype );
+ switch (nKind)
+ {
+ case SID_INSERT_SOUND :
+ {
+ nCheck |= PFDLG_CHECKED_SOUND;
+
+ if( aStrPlugMIMEType.SearchAscii( sAudio ) == 0 )
+ {
+ bFound = true;
+ nCheck |= PFDLG_FOUND_SOUND;
+ }
+ }
+ break;
+ case SID_INSERT_VIDEO :
+ {
+ nCheck |= PFDLG_CHECKED_VIDEO;
+
+ if (aStrPlugMIMEType.SearchAscii( sVideo ) == 0)
+ {
+ bFound = true;
+ nCheck |= PFDLG_FOUND_VIDEO;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ return bFound;
+}
+
+void SvxPluginFileDlg::SetContext( sfx2::FileDialogHelper::Context _eNewContext )
+{
+ maFileDlg.SetContext( _eNewContext );
+}
diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx
new file mode 100644
index 000000000000..0a19d52958e3
--- /dev/null
+++ b/svx/source/dialog/prtqry.cxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <svx/prtqry.hxx>
+#include <svx/dialmgr.hxx>
+#include <tools/shl.hxx>
+
+/* -----------------------------01.02.00 13:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxPrtQryBox::SvxPrtQryBox(Window* pParent) :
+ MessBox(pParent, 0,
+ String(SVX_RES(RID_SVXSTR_QRY_PRINT_TITLE)),
+ String(SVX_RES(RID_SVXSTR_QRY_PRINT_MSG)))
+{
+ SetImage( QueryBox::GetStandardImage() );
+
+ AddButton(String(SVX_RES(RID_SVXSTR_QRY_PRINT_SELECTION)), RET_OK,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON);
+
+ AddButton(String(SVX_RES(RID_SVXSTR_QRY_PRINT_ALL)), 2, 0);
+ AddButton(BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
+ SetButtonHelpText( RET_OK, String() );
+}
+/* -----------------------------01.02.00 13:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxPrtQryBox::~SvxPrtQryBox()
+{
+}
+
+
diff --git a/svx/source/dialog/prtqry.src b/svx/source/dialog/prtqry.src
new file mode 100644
index 000000000000..9ae23f6a4a05
--- /dev/null
+++ b/svx/source/dialog/prtqry.src
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+
+String RID_SVXSTR_QRY_PRINT_TITLE
+{
+ Text [ en-US ] = "Printing selection";
+};
+String RID_SVXSTR_QRY_PRINT_MSG
+{
+ Text [ en-US ] = "Do you want to print the selection or the entire document?";
+};
+String RID_SVXSTR_QRY_PRINT_ALL
+{
+ Text [ en-US ] = "~All";
+};
+String RID_SVXSTR_QRY_PRINT_SELECTION
+{
+ Text [ en-US ] = "~Selection";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/relfld.cxx b/svx/source/dialog/relfld.cxx
new file mode 100644
index 000000000000..2b94fde81edb
--- /dev/null
+++ b/svx/source/dialog/relfld.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#include <tools/ref.hxx>
+#include "svx/relfld.hxx"
+
+// -----------------------------------------------------------------------
+
+SvxRelativeField::SvxRelativeField( Window* pParent, WinBits nWinSize ) :
+ MetricField( pParent, nWinSize )
+{
+ bNegativeEnabled = sal_False;
+ bRelativeMode = sal_False;
+ bRelative = sal_False;
+
+ SetDecimalDigits( 2 );
+ SetMin( 0 );
+ SetMax( 9999 );
+}
+
+// -----------------------------------------------------------------------
+
+SvxRelativeField::SvxRelativeField( Window* pParent, const ResId& rResId ) :
+ MetricField( pParent, rResId )
+{
+ bNegativeEnabled = sal_False;
+ bRelativeMode = sal_False;
+ bRelative = sal_False;
+
+ SetDecimalDigits( 2 );
+ SetMin( 0 );
+ SetMax( 9999 );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::Modify()
+{
+ MetricField::Modify();
+
+ if ( bRelativeMode )
+ {
+ String aStr = GetText();
+ sal_Bool bNewMode = bRelative;
+
+ if ( bRelative )
+ {
+ const sal_Unicode* pStr = aStr.GetBuffer();
+
+ while ( *pStr )
+ {
+ if( ( ( *pStr < sal_Unicode( '0' ) ) || ( *pStr > sal_Unicode( '9' ) ) ) &&
+ ( *pStr != sal_Unicode( '%' ) ) )
+ {
+ bNewMode = sal_False;
+ break;
+ }
+ pStr++;
+ }
+ }
+ else
+ {
+ xub_StrLen nPos = aStr.Search( sal_Unicode( '%' ) );
+
+ if ( nPos != STRING_NOTFOUND )
+ bNewMode = sal_True;
+ }
+
+ if ( bNewMode != bRelative )
+ SetRelative( bNewMode );
+
+ MetricField::Modify();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::EnableRelativeMode( sal_uInt16 nMin,
+ sal_uInt16 nMax, sal_uInt16 nStep )
+{
+ bRelativeMode = sal_True;
+ nRelMin = nMin;
+ nRelMax = nMax;
+ nRelStep = nStep;
+ SetUnit( FUNIT_CM );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRelativeField::SetRelative( sal_Bool bNewRelative )
+{
+ Selection aSelection = GetSelection();
+ String aStr = GetText();
+
+ if ( bNewRelative )
+ {
+ bRelative = sal_True;
+ SetDecimalDigits( 0 );
+ SetMin( nRelMin );
+ SetMax( nRelMax );
+ SetCustomUnitText( String( sal_Unicode( '%' ) ) );
+ SetUnit( FUNIT_CUSTOM );
+ }
+ else
+ {
+ bRelative = sal_False;
+ SetDecimalDigits( 2 );
+ SetMin( bNegativeEnabled ? -9999 : 0 );
+ SetMax( 9999 );
+ SetUnit( FUNIT_CM );
+ }
+
+ SetText( aStr );
+ SetSelection( aSelection );
+}
+
+
diff --git a/svx/source/dialog/rlrcitem.cxx b/svx/source/dialog/rlrcitem.cxx
new file mode 100644
index 000000000000..7e2cd0868cce
--- /dev/null
+++ b/svx/source/dialog/rlrcitem.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+#include <svl/rectitem.hxx>
+
+
+
+
+
+
+#include <svx/dialogs.hrc>
+
+#include <svx/ruler.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include "editeng/protitem.hxx"
+#include "rlrcitem.hxx"
+#include "svx/rulritem.hxx"
+#include <svl/eitem.hxx>
+
+// class SvxRulerItem ----------------------------------------------------
+
+SvxRulerItem::SvxRulerItem(sal_uInt16 _nId, SvxRuler &rRul, SfxBindings &rBindings)
+: SfxControllerItem(_nId, rBindings),
+ rRuler(rRul)
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxRulerItem::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ // SFX_ITEM_DONTCARE => pState == -1 => PTR_CAST buff
+ if ( eState != SFX_ITEM_AVAILABLE )
+ pState = 0;
+
+ switch(nSID)
+ {
+ // Linker / rechter Seitenrand
+ case SID_RULER_LR_MIN_MAX:
+ {
+ const SfxRectangleItem *pItem = PTR_CAST(SfxRectangleItem, pState);
+ rRuler.UpdateFrameMinMax(pItem);
+ break;
+ }
+ case SID_ATTR_LONG_LRSPACE:
+ {
+ const SvxLongLRSpaceItem *pItem = PTR_CAST(SvxLongLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdateFrame(pItem);
+ break;
+ }
+ case SID_ATTR_LONG_ULSPACE:
+ {
+ const SvxLongULSpaceItem *pItem = PTR_CAST(SvxLongULSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxULSpaceItem erwartet");
+ rRuler.UpdateFrame(pItem);
+ break;
+ }
+ case SID_ATTR_TABSTOP_VERTICAL:
+ case SID_ATTR_TABSTOP:
+ {
+ const SvxTabStopItem *pItem = PTR_CAST(SvxTabStopItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxTabStopItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_ATTR_PARA_LRSPACE_VERTICAL:
+ case SID_ATTR_PARA_LRSPACE:
+ {
+ const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdatePara(pItem);
+ break;
+ }
+ case SID_RULER_BORDERS_VERTICAL:
+ case SID_RULER_BORDERS:
+ case SID_RULER_ROWS:
+ case SID_RULER_ROWS_VERTICAL:
+ {
+ const SvxColumnItem *pItem = PTR_CAST(SvxColumnItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxColumnItem erwartet");
+#ifdef DBG_UTIL
+ if(pItem)
+ {
+ if(pItem->IsConsistent())
+ rRuler.Update(pItem, nSID);
+ else
+ DBG_ERROR("Spaltenitem corrupted");
+ }
+ else
+ rRuler.Update(pItem, nSID);
+#else
+ rRuler.Update(pItem, nSID);
+#endif
+ break;
+ }
+ case SID_RULER_PAGE_POS:
+ { // Position Seite, Seitenbreite
+ const SvxPagePosSizeItem *pItem = PTR_CAST(SvxPagePosSizeItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxPagePosSizeItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_OBJECT:
+ { // Object-Selektion
+ const SvxObjectItem *pItem = PTR_CAST(SvxObjectItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxObjectItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_PROTECT:
+ {
+ const SvxProtectItem *pItem = PTR_CAST(SvxProtectItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxProtectItem erwartet");
+ rRuler.Update(pItem);
+ break;
+ }
+ case SID_RULER_BORDER_DISTANCE:
+ {
+ const SvxLRSpaceItem *pItem = PTR_CAST(SvxLRSpaceItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SvxLRSpaceItem erwartet");
+ rRuler.UpdateParaBorder(pItem);
+ }
+ break;
+ case SID_RULER_TEXT_RIGHT_TO_LEFT :
+ {
+ const SfxBoolItem *pItem = PTR_CAST(SfxBoolItem, pState);
+ DBG_ASSERT(pState? 0 != pItem: sal_True, "SfxBoolItem erwartet");
+ rRuler.UpdateTextRTL(pItem);
+ }
+ break;
+ }
+}
+
+
diff --git a/svx/source/dialog/rlrcitem.hxx b/svx/source/dialog/rlrcitem.hxx
new file mode 100644
index 000000000000..dccb5d97a2ec
--- /dev/null
+++ b/svx/source/dialog/rlrcitem.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RLRCITEM_HXX
+#define _SVX_RLRCITEM_HXX
+
+#include <sfx2/ctrlitem.hxx>
+
+class SvxRuler;
+
+// class SvxRulerItem ----------------------------------------------------
+
+class SvxRulerItem : public SfxControllerItem
+{
+private:
+ SvxRuler& rRuler;
+
+protected:
+ virtual void StateChanged( sal_uInt16,
+ SfxItemState, const SfxPoolItem* pState );
+
+public:
+ SvxRulerItem( sal_uInt16 nId, SvxRuler&, SfxBindings& );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
new file mode 100644
index 000000000000..a85fc023eca5
--- /dev/null
+++ b/svx/source/dialog/rubydialog.cxx
@@ -0,0 +1,990 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/rubydialog.hxx>
+#include <tools/shl.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+#include <rubydialog.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/eitem.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/text/XRubySelection.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/text/RubyAdjust.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#include <svtools/colorcfg.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::text;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::style;
+using namespace com::sun::star::text;
+using namespace com::sun::star::view;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
+using rtl::OUString;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+SFX_IMPL_CHILDWINDOW( SvxRubyChildWindow, SID_RUBY_DIALOG );
+
+static const sal_Char cRubyBaseText[] = "RubyBaseText";
+static const sal_Char cRubyText[] = "RubyText";
+static const sal_Char cCharacterStyles[] = "CharacterStyles";
+static const sal_Char cRubyAdjust[] = "RubyAdjust";
+static const sal_Char cRubyIsAbove[] = "RubyIsAbove";
+static const sal_Char cDisplayName[] = "DisplayName";
+static const sal_Char cRubyCharStyleName[] = "RubyCharStyleName";
+static const sal_Char cRubies[] = "Rubies";
+/* -----------------------------09.01.01 17:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyChildWindow::SvxRubyChildWindow( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo) :
+ SfxChildWindow(_pParent, nId)
+{
+ pWindow = new SvxRubyDialog( pBindings, this, _pParent, SVX_RES( RID_SVXDLG_RUBY ) );
+ SvxRubyDialog* pDlg = (SvxRubyDialog*) pWindow;
+
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ pDlg->RollUp();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+
+ pDlg->Initialize( pInfo );
+}
+/* -----------------------------10.01.01 13:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxChildWinInfo SvxRubyChildWindow::GetInfo() const
+{
+ return SfxChildWindow::GetInfo();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SvxRubyData_Impl : public cppu::WeakImplHelper1
+ < ::com::sun::star::view::XSelectionChangeListener >
+{
+ Reference<XModel> xModel;
+ Reference<XRubySelection> xSelection;
+ Sequence<PropertyValues> aRubyValues;
+ Reference<XController> xController;
+ sal_Bool bHasSelectionChanged;
+ public:
+ SvxRubyData_Impl();
+ ~SvxRubyData_Impl();
+
+ void SetController(Reference<XController> xCtrl);
+ Reference<XModel> GetModel()
+ {
+ if(!xController.is())
+ xModel = 0;
+ else
+ xModel = xController->getModel();
+ return xModel;
+ }
+ sal_Bool HasSelectionChanged() const{return bHasSelectionChanged;}
+ Reference<XRubySelection> GetRubySelection()
+ {
+ xSelection = Reference<XRubySelection>(xController, UNO_QUERY);
+ return xSelection;
+ }
+ void UpdateRubyValues(sal_Bool bAutoUpdate)
+ {
+ if(!xSelection.is())
+ aRubyValues.realloc(0);
+ else
+ aRubyValues = xSelection->getRubyList(bAutoUpdate);
+ bHasSelectionChanged = sal_False;
+ }
+ Sequence<PropertyValues>& GetRubyValues() {return aRubyValues;}
+ void AssertOneEntry();
+
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException);
+
+};
+//-----------------------------------------------------------------------------
+SvxRubyData_Impl::SvxRubyData_Impl() :
+ bHasSelectionChanged(sal_False)
+{
+}
+//-----------------------------------------------------------------------------
+SvxRubyData_Impl::~SvxRubyData_Impl()
+{
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::SetController(Reference<XController> xCtrl)
+{
+ if(xCtrl.get() != xController.get())
+ {
+ try
+ {
+ Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->removeSelectionChangeListener(this);
+
+ bHasSelectionChanged = sal_True;
+ xController = xCtrl;
+ xSelSupp = Reference<XSelectionSupplier>(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->addSelectionChangeListener(this);
+ }
+ catch(Exception&)
+ {}
+ }
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::selectionChanged( const EventObject& ) throw (RuntimeException)
+{
+ bHasSelectionChanged = sal_True;
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::disposing( const EventObject&) throw (RuntimeException)
+{
+ try
+ {
+ Reference<XSelectionSupplier> xSelSupp(xController, UNO_QUERY);
+ if(xSelSupp.is())
+ xSelSupp->removeSelectionChangeListener(this);
+ }
+ catch(Exception&)
+ {}
+ xController = 0;
+}
+//-----------------------------------------------------------------------------
+void SvxRubyData_Impl::AssertOneEntry()
+{
+ //create one entry
+ if(!aRubyValues.getLength())
+ {
+ aRubyValues.realloc(1);
+ Sequence<PropertyValue>& rValues = aRubyValues.getArray()[0];
+ rValues.realloc(5);
+ PropertyValue* pValues = rValues.getArray();
+ pValues[0].Name = C2U(cRubyBaseText);
+ pValues[1].Name = C2U(cRubyText);
+ pValues[2].Name = C2U(cRubyAdjust);
+ pValues[3].Name = C2U(cRubyIsAbove);
+ pValues[4].Name = C2U(cRubyCharStyleName);
+ }
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyDialog::SvxRubyDialog( SfxBindings *pBind, SfxChildWindow *pCW,
+ Window* _pParent, const ResId& rResId ) :
+ SfxModelessDialog( pBind, pCW, _pParent, rResId ),
+ aLeftFT(this, ResId(FT_LEFT,*rResId.GetResMgr() )),
+ aLeft1ED(this, ResId(ED_LEFT_1,*rResId.GetResMgr() )),
+ aRightFT(this, ResId(FT_RIGHT,*rResId.GetResMgr() )),
+ aRight1ED(this, ResId(ED_RIGHT_1,*rResId.GetResMgr() )),
+ aLeft2ED(this, ResId(ED_LEFT_2,*rResId.GetResMgr() )),
+ aRight2ED(this, ResId(ED_RIGHT_2,*rResId.GetResMgr() )),
+ aLeft3ED(this, ResId(ED_LEFT_3,*rResId.GetResMgr() )),
+ aRight3ED(this, ResId(ED_RIGHT_3,*rResId.GetResMgr() )),
+ aLeft4ED(this, ResId(ED_LEFT_4,*rResId.GetResMgr() )),
+ aRight4ED(this, ResId(ED_RIGHT_4,*rResId.GetResMgr() )),
+ aScrollSB(this, ResId(SB_SCROLL,*rResId.GetResMgr() )),
+ aAutoDetectionCB(this, ResId(CB_AUTO_DETECT,*rResId.GetResMgr() )),
+ aAdjustFT(this, ResId(FT_ADJUST,*rResId.GetResMgr() )),
+ aAdjustLB(this, ResId(LB_ADJUST,*rResId.GetResMgr() )),
+ aPositionFT(this, ResId(FT_POSITION,*rResId.GetResMgr() )),
+ aPositionLB(this, ResId(LB_POSITION,*rResId.GetResMgr() )),
+ aCharStyleFT(this, ResId(FT_CHAR_STYLE,*rResId.GetResMgr() )),
+ aCharStyleLB(this, ResId(LB_CHAR_STYLE,*rResId.GetResMgr() )),
+ aStylistPB(this, ResId(PB_STYLIST,*rResId.GetResMgr() )),
+ aPreviewFT(this, ResId(FT_PREVIEW,*rResId.GetResMgr() )),
+ aPreviewWin(*this, ResId(WIN_PREVIEW,*rResId.GetResMgr() )),
+ aApplyPB(this, ResId(PB_APPLY,*rResId.GetResMgr() )),
+ aClosePB(this, ResId(PB_CLOSE,*rResId.GetResMgr() )),
+ aHelpPB(this, ResId(PB_HELP,*rResId.GetResMgr() )),
+ nLastPos(0),
+ nCurrentEdit(0),
+ bModified(sal_False),
+ pBindings(pBind)
+{
+ xImpl = pImpl = new SvxRubyData_Impl;
+ FreeResource();
+ //#85638# automatic detection not yet available
+ aAutoDetectionCB.Hide();
+ aEditArr[0] = &aLeft1ED; aEditArr[1] = &aRight1ED;
+ aEditArr[2] = &aLeft2ED; aEditArr[3] = &aRight2ED;
+ aEditArr[4] = &aLeft3ED; aEditArr[5] = &aRight3ED;
+ aEditArr[6] = &aLeft4ED; aEditArr[7] = &aRight4ED;
+
+ aApplyPB.SetClickHdl(LINK(this, SvxRubyDialog, ApplyHdl_Impl));
+ aClosePB.SetClickHdl(LINK(this, SvxRubyDialog, CloseHdl_Impl));
+ aStylistPB.SetClickHdl(LINK(this, SvxRubyDialog, StylistHdl_Impl));
+ aAutoDetectionCB.SetClickHdl(LINK(this, SvxRubyDialog, AutomaticHdl_Impl));
+ aAdjustLB.SetSelectHdl(LINK(this, SvxRubyDialog, AdjustHdl_Impl));
+ aPositionLB.SetSelectHdl(LINK(this, SvxRubyDialog, PositionHdl_Impl));
+ aCharStyleLB.SetSelectHdl(LINK(this, SvxRubyDialog, CharStyleHdl_Impl));
+
+ Link aScrLk(LINK(this, SvxRubyDialog, ScrollHdl_Impl));
+ aScrollSB.SetScrollHdl( aScrLk );
+ aScrollSB.SetEndScrollHdl( aScrLk );
+
+ Link aEditLk(LINK(this, SvxRubyDialog, EditModifyHdl_Impl));
+ Link aScrollLk(LINK(this, SvxRubyDialog, EditScrollHdl_Impl));
+ Link aJumpLk(LINK(this, SvxRubyDialog, EditJumpHdl_Impl));
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ aEditArr[i]->SetModifyHdl(aEditLk);
+ aEditArr[i]->SetJumpHdl(aJumpLk);
+ if(!i || 7 == i)
+ aEditArr[i]->SetScrollHdl(aScrollLk);
+ }
+
+ UpdateColors();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxRubyDialog::~SvxRubyDialog()
+{
+ ClearCharStyleList();
+ EventObject aEvent;
+ xImpl->disposing(aEvent);
+}
+/* -----------------------------01.02.01 10:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::ClearCharStyleList()
+{
+ for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++)
+ {
+ void* pData = aCharStyleLB.GetEntryData(i);
+ delete (OUString*)pData;
+ }
+ aCharStyleLB.Clear();
+}
+/* -----------------------------09.01.01 17:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SvxRubyDialog::Close()
+{
+ pBindings->GetDispatcher()->Execute( SID_RUBY_DIALOG,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ return sal_True;
+}
+/* -----------------------------29.01.01 15:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::Activate()
+{
+ SfxModelessDialog::Activate();
+ SfxPoolItem* pState = 0;
+ SfxItemState eState = pBindings->QueryState( SID_STYLE_DESIGNER, pState );
+ sal_Bool bEnable = (eState < SFX_ITEM_AVAILABLE) || !pState || !((SfxBoolItem*)pState)->GetValue();
+ aStylistPB.Enable(bEnable);
+ //get selection from current view frame
+ SfxViewFrame* pCurFrm = SfxViewFrame::Current();
+ Reference< XController > xCtrl = pCurFrm->GetFrame().GetController();
+ pImpl->SetController(xCtrl);
+ if(pImpl->HasSelectionChanged())
+ {
+
+ Reference< XRubySelection > xRubySel = pImpl->GetRubySelection();
+ pImpl->UpdateRubyValues(aAutoDetectionCB.IsChecked());
+ EnableControls(xRubySel.is());
+ if(xRubySel.is())
+ {
+ Reference< XModel > xModel = pImpl->GetModel();
+ const String sCharStyleSelect = aCharStyleLB.GetSelectEntry();
+ ClearCharStyleList();
+ Reference<XStyleFamiliesSupplier> xSupplier(xModel, UNO_QUERY);
+ if(xSupplier.is())
+ {
+ try
+ {
+ Reference<XNameAccess> xFam = xSupplier->getStyleFamilies();
+ Any aChar = xFam->getByName(C2U(cCharacterStyles));
+ Reference<XNameContainer> xChar;
+ aChar >>= xChar;
+ Reference<XIndexAccess> xCharIdx(xChar, UNO_QUERY);
+ if(xCharIdx.is())
+ {
+ OUString sUIName(C2U(cDisplayName));
+ for(sal_Int32 nStyle = 0; nStyle < xCharIdx->getCount(); nStyle++)
+ {
+ Any aStyle = xCharIdx->getByIndex(nStyle);
+ Reference<XStyle> xStyle;
+ aStyle >>= xStyle;
+ Reference<XPropertySet> xPrSet(xStyle, UNO_QUERY);
+ OUString sName, sCoreName;
+ if(xPrSet.is())
+ {
+ Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo();
+ if(xInfo->hasPropertyByName(sUIName))
+ {
+ Any aName = xPrSet->getPropertyValue(sUIName);
+ aName >>= sName;
+ }
+ }
+ Reference<XNamed> xNamed(xStyle, UNO_QUERY);
+ if(xNamed.is())
+ {
+ sCoreName = xNamed->getName();
+ if(!sName.getLength())
+ sName = sCoreName;
+ }
+ if(sName.getLength())
+ {
+ sal_uInt16 nPos = aCharStyleLB.InsertEntry(sName);
+ aCharStyleLB.SetEntryData( nPos, new OUString(sCoreName) );
+
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception in style access");
+ }
+ if(sCharStyleSelect.Len())
+ aCharStyleLB.SelectEntry(sCharStyleSelect);
+ }
+ aCharStyleLB.Enable(xSupplier.is());
+ aCharStyleFT.Enable(xSupplier.is());
+ }
+ Update();
+ aPreviewWin.Invalidate();
+ }
+}
+/* -----------------------------29.01.01 15:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::Deactivate()
+{
+ SfxModelessDialog::Deactivate();
+}
+/* -----------------------------30.01.01 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::SetText(sal_Int32 nPos, Edit& rLeft, Edit& rRight)
+{
+ OUString sLeft, sRight;
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ sal_Bool bEnable = aRubyValues.getLength() > nPos;
+ if(bEnable)
+ {
+ const Sequence<PropertyValue> aProps = aRubyValues.getConstArray()[nPos];
+ const PropertyValue* pProps = aProps.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < aProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyBaseText)))
+ pProps[nProp].Value >>= sLeft;
+ else if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyText)))
+ pProps[nProp].Value >>= sRight;
+ }
+ }
+ else if(!nPos)
+ bEnable = sal_True;
+ rLeft.Enable(bEnable);
+ rRight.Enable(bEnable);
+ rLeft.SetText(sLeft);
+ rRight.SetText(sRight);
+ rLeft.SaveValue();
+ rRight.SaveValue();
+}
+//-----------------------------------------------------------------------------
+void SvxRubyDialog::GetText()
+{
+ long nTempLastPos = GetLastPos();
+ for(int i = 0; i < 8; i+=2)
+ {
+ if(aEditArr[i]->IsEnabled() &&
+ (aEditArr[i]->GetText() != aEditArr[i]->GetSavedValue() ||
+ aEditArr[i + 1]->GetText() != aEditArr[i + 1]->GetSavedValue()))
+ {
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" );
+ SetModified(sal_True);
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[i / 2 + nTempLastPos];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyBaseText)))
+ pProps[nProp].Value <<= OUString(aEditArr[i]->GetText());
+ else if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyText)))
+ pProps[nProp].Value <<= OUString(aEditArr[i + 1]->GetText());
+ }
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+void SvxRubyDialog::Update()
+{
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ sal_Int32 nLen = aRubyValues.getLength();
+ aScrollSB.Enable(nLen > 4);
+ aScrollSB.SetRange( Range(0, nLen > 4 ? nLen - 4 : 0));
+ aScrollSB.SetThumbPos(0);
+ SetLastPos(0);
+ SetModified(sal_False);
+
+ sal_Int16 nAdjust = -1;
+ sal_Int16 nPosition = -1;
+ OUString sCharStyleName, sTmp;
+ sal_Bool bCharStyleEqual = sal_True;
+ for(sal_Int32 nRuby = 0; nRuby < nLen; nRuby++)
+ {
+ const Sequence<PropertyValue> &rProps = aRubyValues.getConstArray()[nRuby];
+ const PropertyValue* pProps = rProps.getConstArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(nAdjust > -2 &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyAdjust)))
+ {
+ sal_Int16 nTmp = sal_Int16();
+ pProps[nProp].Value >>= nTmp;
+ if(!nRuby)
+ nAdjust = nTmp;
+ else if(nAdjust != nTmp)
+ nAdjust = -2;
+ }
+ if(nPosition > -2 &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyIsAbove)))
+ {
+ sal_Bool bTmp = *(sal_Bool*)pProps[nProp].Value.getValue();
+ if(!nRuby)
+ nPosition = bTmp ? 0 : 1;
+ else if( (!nPosition && !bTmp) || (nPosition == 1 && bTmp) )
+ nPosition = -2;
+ }
+ if(bCharStyleEqual &&
+ pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyCharStyleName)))
+ {
+ pProps[nProp].Value >>= sTmp;
+ if(!nRuby)
+ sCharStyleName = sTmp;
+ else if(sCharStyleName != sTmp)
+ bCharStyleEqual = sal_False;
+ }
+ }
+ }
+ if(!nLen)
+ {
+ //enable selection if the ruby list is empty
+ nAdjust = 0;
+ nPosition = 0;
+ }
+ if(nAdjust > -1)
+ aAdjustLB.SelectEntryPos(nAdjust);
+ else
+ aAdjustLB.SetNoSelection();
+ if(nPosition > -1)
+ aPositionLB.SelectEntryPos(nPosition ? 1 : 0);
+ if(!nLen || (bCharStyleEqual && !sCharStyleName.getLength()))
+ sCharStyleName = C2U(cRubies);
+ if(sCharStyleName.getLength())
+ {
+ for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++)
+ {
+ const OUString* pCoreName = (const OUString*)aCharStyleLB.GetEntryData(i);
+ if(pCoreName && sCharStyleName == *pCoreName)
+ {
+ aCharStyleLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ else
+ aCharStyleLB.SetNoSelection();
+
+ ScrollHdl_Impl(&aScrollSB);
+}
+/* -----------------------------16.02.01 14:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::GetCurrentText(String& rBase, String& rRuby)
+{
+ rBase = aEditArr[nCurrentEdit * 2]->GetText();
+ rRuby = aEditArr[nCurrentEdit * 2 + 1]->GetText();
+}
+/* -----------------------------31.01.01 14:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, ScrollHdl_Impl, ScrollBar*, pScroll)
+{
+ long nPos = pScroll->GetThumbPos();
+ if(GetLastPos() != nPos)
+ {
+ GetText();
+ }
+ SetText(nPos++, aLeft1ED, aRight1ED);
+ SetText(nPos++, aLeft2ED, aRight2ED);
+ SetText(nPos++, aLeft3ED, aRight3ED);
+ SetText(nPos, aLeft4ED, aRight4ED);
+ SetLastPos(nPos - 3);
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------30.01.01 14:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, ApplyHdl_Impl, PushButton*, EMPTYARG)
+{
+ const Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ if(!aRubyValues.getLength())
+ {
+ AssertOneEntry();
+ PositionHdl_Impl(&aPositionLB);
+ AdjustHdl_Impl(&aAdjustLB);
+ CharStyleHdl_Impl(&aCharStyleLB);
+ }
+ GetText();
+ //reset all edit fields - SaveValue is called
+ ScrollHdl_Impl(&aScrollSB);
+
+ Reference<XRubySelection> xSelection = pImpl->GetRubySelection();
+ if(IsModified() && xSelection.is())
+ {
+ try
+ {
+ xSelection->setRubyList(aRubyValues, aAutoDetectionCB.IsChecked());
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("Exception caught");
+ }
+ }
+ return 0;
+}
+/* -----------------------------29.01.01 09:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, CloseHdl_Impl, PushButton*, EMPTYARG)
+{
+ Close();
+ return 0;
+}
+/* -----------------------------29.01.01 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, StylistHdl_Impl, PushButton*, EMPTYARG)
+{
+ SfxPoolItem* pState = 0;
+ SfxItemState eState = pBindings->QueryState( SID_STYLE_DESIGNER, pState );
+ if(eState <= SFX_ITEM_SET || !pState || !((SfxBoolItem*)pState)->GetValue())
+ {
+ pBindings->GetDispatcher()->Execute( SID_STYLE_DESIGNER,
+ SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD);
+ }
+ return 0;
+}
+/* -----------------------------30.01.01 15:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, AutomaticHdl_Impl, CheckBox*, pBox)
+{
+ pImpl->UpdateRubyValues(pBox->IsChecked());
+ Update();
+ return 0;
+}
+/* -----------------------------31.01.01 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox*, pBox)
+{
+ AssertOneEntry();
+ sal_Int16 nAdjust = pBox->GetSelectEntryPos();
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyAdjust)))
+ pProps[nProp].Value <<= nAdjust;
+ }
+ SetModified(sal_True);
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------01.06.01 10:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox*, pBox)
+{
+ AssertOneEntry();
+ sal_Bool bAbove = !pBox->GetSelectEntryPos();
+ const Type& rType = ::getBooleanCppuType();
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyIsAbove)))
+ pProps[nProp].Value.setValue(&bAbove, rType);
+ }
+ SetModified(sal_True);
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------01.02.01 10:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, CharStyleHdl_Impl, ListBox*, EMPTYARG )
+{
+ AssertOneEntry();
+ OUString sStyleName;
+ if(LISTBOX_ENTRY_NOTFOUND != aCharStyleLB.GetSelectEntryPos())
+ sStyleName = *(OUString*) aCharStyleLB.GetEntryData(aCharStyleLB.GetSelectEntryPos());
+ Sequence<PropertyValues>& aRubyValues = pImpl->GetRubyValues();
+ for(sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++)
+ {
+ Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby];
+ PropertyValue* pProps = rProps.getArray();
+ for(sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++)
+ {
+ if(pProps[nProp].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cRubyCharStyleName)))
+ {
+ pProps[nProp].Value <<= sStyleName;
+ }
+ }
+ SetModified(sal_True);
+ }
+ return 0;
+}
+/* -----------------------------16.02.01 08:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditModifyHdl_Impl, Edit*, pEdit)
+{
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ if(pEdit == aEditArr[i])
+ {
+ nCurrentEdit = i / 2;
+ break;
+ }
+ }
+ aPreviewWin.Invalidate();
+ return 0;
+}
+/* -----------------------------17.07.01 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditScrollHdl_Impl, sal_Int32*, pParam)
+{
+ long nRet = 0;
+ if(aScrollSB.IsEnabled())
+ {
+ //scroll forward
+ if(*pParam > 0 && (aEditArr[7]->HasFocus() || aEditArr[6]->HasFocus() ))
+ {
+ if(aScrollSB.GetRangeMax() > aScrollSB.GetThumbPos())
+ {
+ aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() + 1);
+ aEditArr[6]->GrabFocus();
+ nRet = 1;
+ }
+ }
+ //scroll backward
+ else if(aScrollSB.GetThumbPos() && (aEditArr[0]->HasFocus()||aEditArr[1]->HasFocus()) )
+ {
+ aScrollSB.SetThumbPos(aScrollSB.GetThumbPos() - 1);
+ aEditArr[1]->GrabFocus();
+ nRet = 1;
+ }
+ if(nRet)
+ ScrollHdl_Impl(&aScrollSB);
+ }
+ return nRet;
+}
+/* -----------------------------20.07.2001 15:18------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SvxRubyDialog, EditJumpHdl_Impl, sal_Int32*, pParam)
+{
+ sal_uInt16 nIndex = USHRT_MAX;
+ for(sal_uInt16 i = 0; i < 8; i++)
+ {
+ if(aEditArr[i]->HasFocus())
+ nIndex = i;
+ }
+ if(nIndex < 8)
+ {
+ if(*pParam > 0)
+ {
+ if(nIndex < 6)
+ aEditArr[nIndex + 2]->GrabFocus();
+ else if( EditScrollHdl_Impl(pParam))
+ aEditArr[nIndex]->GrabFocus();
+ }
+ else
+ {
+ if(nIndex > 1)
+ aEditArr[nIndex - 2]->GrabFocus();
+ else if( EditScrollHdl_Impl(pParam))
+ aEditArr[nIndex]->GrabFocus();
+ }
+ }
+ return 0;
+};
+/* -----------------------------19.06.01 11:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRubyDialog::AssertOneEntry()
+{
+ pImpl->AssertOneEntry();
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxRubyDialog::UpdateColors( void )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+
+ Font aFnt( aPreviewWin.GetFont() );
+
+ Color aNewTextCol( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+ Color aNewFillCol( rStyleSettings.GetWindowColor() );
+
+ if( aNewFillCol != aFnt.GetFillColor() || aNewTextCol != aFnt.GetColor() )
+ {
+ aFnt.SetFillColor( aNewFillCol );
+ aFnt.SetColor( aNewTextCol );
+ aPreviewWin.SetFont( aFnt );
+
+ aPreviewWin.Invalidate();
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void SvxRubyDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SfxModelessDialog::DataChanged( rDCEvt );
+
+ if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ UpdateColors();
+}
+
+/* -----------------------------29.01.01 15:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_MoveBox(long nOffset, Edit& rLeft, Edit& rRight)
+{
+ Size aLeftSz(rLeft.GetSizePixel());
+ Point aRightPos(rRight.GetPosPixel());
+ Size aRightSz(rRight.GetSizePixel());
+ aLeftSz.Width() += nOffset;
+ aRightSz.Width() -= nOffset;
+ aRightPos.X() += nOffset;
+ rLeft.SetSizePixel(aLeftSz);
+ rRight.SetPosSizePixel(aRightPos, aRightSz);
+
+}
+/* -----------------------------16.02.01 08:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+RubyPreview::RubyPreview(SvxRubyDialog& rParent, const ResId& rResId) :
+ Window(&rParent, rResId),
+ rParentDlg(rParent)
+{
+ SetMapMode(MAP_TWIP);
+ Size aWinSize = GetOutputSize();
+
+ Font aFont = GetFont();
+ aFont.SetHeight(aWinSize.Height() / 4);
+ SetFont(aFont);
+
+ SetBorderStyle( WINDOW_BORDER_MONO );
+}
+/* -----------------------------29.01.01 14:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void RubyPreview::Paint( const Rectangle& /* rRect */ )
+{
+ Font aRubyFont = GetFont();
+ Font aSaveFont(aRubyFont);
+ aRubyFont.SetHeight(aRubyFont.GetHeight() * 70 / 100);
+
+ Size aWinSize = GetOutputSize();
+ Rectangle aRect(Point(0, 0), aWinSize);
+ SetLineColor();
+ SetFillColor( aSaveFont.GetFillColor() );
+ DrawRect(aRect);
+
+ String sBaseText, sRubyText;
+ rParentDlg.GetCurrentText(sBaseText, sRubyText);
+
+ long nTextHeight = GetTextHeight();
+ long nBaseWidth = GetTextWidth(sBaseText);
+ SetFont(aRubyFont);
+ long nRubyWidth = GetTextWidth(sRubyText);
+ SetFont(aSaveFont);
+
+ sal_uInt16 nAdjust = rParentDlg.aAdjustLB.GetSelectEntryPos();
+ //use center if no adjustment is available
+ if(nAdjust > 4)
+ nAdjust = 1;
+
+ //which part is stretched ?
+ sal_Bool bRubyStretch = nBaseWidth >= nRubyWidth;
+
+ long nCenter = aWinSize.Width() / 2;
+ long nLeftStart = nCenter - (bRubyStretch ? (nBaseWidth / 2) : (nRubyWidth / 2));
+ long nRightEnd = nCenter + (bRubyStretch ? (nBaseWidth / 2) : (nRubyWidth / 2));
+
+ long nYRuby = aWinSize.Height() / 4 - nTextHeight / 2;
+ long nYBase = aWinSize.Height() * 3 / 4 - nTextHeight / 2;
+
+ //use above also if no selection is set
+ sal_Bool bAbove = rParentDlg.aPositionLB.GetSelectEntryPos() != 1;
+ if(!bAbove)
+ {
+ long nTmp = nYRuby;
+ nYRuby = nYBase;
+ nYBase = nTmp;
+ }
+ long nYOutput, nOutTextWidth;
+ String sOutputText;
+
+
+ if(bRubyStretch)
+ {
+ DrawText( Point( nLeftStart , nYBase), sBaseText );
+ nYOutput = nYRuby;
+ sOutputText = sRubyText;
+ nOutTextWidth = nRubyWidth;
+ SetFont(aRubyFont);
+ }
+ else
+ {
+ SetFont(aRubyFont);
+ DrawText( Point( nLeftStart , nYRuby), sRubyText );
+ nYOutput = nYBase;
+ sOutputText = sBaseText;
+ nOutTextWidth = nBaseWidth;
+ SetFont(aSaveFont);
+ }
+
+ switch(nAdjust)
+ {
+ case RubyAdjust_LEFT:
+ DrawText( Point( nLeftStart , nYOutput), sOutputText );
+ break;
+ case RubyAdjust_RIGHT:
+ DrawText( Point( nRightEnd - nOutTextWidth, nYOutput), sOutputText );
+ break;
+ case RubyAdjust_INDENT_BLOCK:
+ {
+ long nCharWidth = GetTextWidth(String::CreateFromAscii("X"));
+ if(nOutTextWidth < (nRightEnd - nLeftStart - nCharWidth))
+ {
+ nCharWidth /= 2;
+ nLeftStart += nCharWidth;
+ nRightEnd -= nCharWidth;
+ }
+ }
+ // no break!
+ case RubyAdjust_BLOCK:
+ if(sOutputText.Len() > 1)
+ {
+ xub_StrLen nCount = sOutputText.Len();
+ long nSpace = ((nRightEnd - nLeftStart) - GetTextWidth(sOutputText)) / (nCount - 1);
+ for(xub_StrLen i = 0; i < nCount; i++)
+ {
+ sal_Unicode cChar = sOutputText.GetChar(i);
+ DrawText( Point( nLeftStart , nYOutput), cChar);
+ long nCharWidth = GetTextWidth(cChar);
+ nLeftStart += nCharWidth + nSpace;
+ }
+ break;
+ }
+ //no break;
+ case RubyAdjust_CENTER:
+ DrawText( Point( nCenter - nOutTextWidth / 2 , nYOutput), sOutputText );
+ break;
+ }
+ SetFont(aSaveFont);
+}
+/* -----------------------------16.02.01 15:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void RubyEdit::GetFocus()
+{
+ GetModifyHdl().Call(this);
+ Edit::GetFocus();
+}
+/* -----------------------------17.07.01 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+long RubyEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode = pKEvt->GetKeyCode();
+ sal_uInt16 nMod = rKeyCode.GetModifier();
+ sal_uInt16 nCode = rKeyCode.GetCode();
+ if( nCode == KEY_TAB && (!nMod || KEY_SHIFT == nMod))
+ {
+ sal_Int32 nParam = KEY_SHIFT == nMod ? -1 : 1;
+ if(aScrollHdl.IsSet() && aScrollHdl.Call(&nParam))
+ nHandled = 1;
+ }
+ else if(KEY_UP == nCode || KEY_DOWN == nCode)
+ {
+ sal_Int32 nParam = KEY_UP == nCode ? -1 : 1;
+ aJumpHdl.Call(&nParam);
+ }
+ }
+ if(!nHandled)
+ nHandled = Edit::PreNotify(rNEvt);
+ return nHandled;
+}
+
diff --git a/svx/source/dialog/rubydialog.hrc b/svx/source/dialog/rubydialog.hrc
new file mode 100644
index 000000000000..f22b1da10ea7
--- /dev/null
+++ b/svx/source/dialog/rubydialog.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define CB_AUTO_DETECT 1
+#define FT_CHAR_STYLE 2
+#define LB_CHAR_STYLE 3
+#define PB_STYLIST 4
+#define FT_PREVIEW 5
+#define WIN_PREVIEW 6
+#define PB_APPLY 7
+#define PB_CLOSE 8
+#define PB_HELP 9
+#define ED_LEFT_1 10
+#define ED_LEFT_2 11
+#define ED_LEFT_3 12
+#define ED_LEFT_4 13
+#define ED_RIGHT_1 14
+#define ED_RIGHT_2 15
+#define ED_RIGHT_3 16
+#define ED_RIGHT_4 17
+#define HB_HEADER 18
+#define SB_SCROLL 19
+#define FT_LEFT 20
+#define FT_RIGHT 21
+#define FT_ADJUST 22
+#define LB_ADJUST 23
+#define FT_POSITION 24
+#define LB_POSITION 25
+
diff --git a/svx/source/dialog/rubydialog.src b/svx/source/dialog/rubydialog.src
new file mode 100644
index 000000000000..e10d4d0e57e2
--- /dev/null
+++ b/svx/source/dialog/rubydialog.src
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <rubydialog.hrc>
+#include "helpid.hrc"
+#include <svx/dialogs.hrc>
+
+ModelessDialog RID_SVXDLG_RUBY
+{
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_RUBY_DIALOG;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 227 , 195 ) ;
+ Text [ en-US ] = "Asian Phonetic Guide" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ CheckBox CB_AUTO_DETECT
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_RUBY:CB_AUTO_DETECT";
+ Pos = MAP_APPFONT ( 6, 6 ) ;
+ Size = MAP_APPFONT ( 186 , 12 ) ;
+ Text [ en-US ] = "Automatic detection";
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Base text";
+ };
+ FixedText FT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 109 , 17 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Ruby text";
+ };
+ Edit ED_LEFT_1
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_1";
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Hide = False;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_1
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_1";
+ Pos = MAP_APPFONT ( 109 , 30 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_2
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_2";
+ Pos = MAP_APPFONT ( 6 , 42) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_2
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_2";
+ Pos = MAP_APPFONT ( 109 , 42 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_3
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_3";
+ Pos = MAP_APPFONT ( 6 , 54 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_3
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_3";
+ Pos = MAP_APPFONT ( 109 , 54 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_LEFT_4
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_LEFT_4";
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ Edit ED_RIGHT_4
+ {
+ HelpID = "svx:Edit:RID_SVXDLG_RUBY:ED_RIGHT_4";
+ Pos = MAP_APPFONT ( 109 , 66 ) ;
+ Size = MAP_APPFONT ( 102 , 12 ) ;
+ Border = TRUE;
+ };
+ ScrollBar SB_SCROLL
+ {
+ Pos = MAP_APPFONT ( 213 , 30 ) ;
+ Size = MAP_APPFONT ( 8 , 48 ) ;
+ VScroll = TRUE ;
+ Drag = TRUE ;
+ };
+ FixedText FT_ADJUST
+ {
+ Pos = MAP_APPFONT ( 6 , 82 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Alignment";
+ };
+ ListBox LB_ADJUST
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_ADJUST";
+ Pos = MAP_APPFONT ( 6 , 93) ;
+ Size = MAP_APPFONT ( 35 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ "Left" ;
+ "Center" ;
+ "Right" ;
+ "0 1 0" ;
+ "1 2 1" ;
+ };
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 43 , 82 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ ListBox LB_POSITION
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_POSITION";
+ Pos = MAP_APPFONT ( 43 , 93) ;
+ Size = MAP_APPFONT ( 35 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ "Top" ;
+ "Bottom" ;
+ };
+ };
+ FixedText FT_CHAR_STYLE
+ {
+ Pos = MAP_APPFONT ( 80 , 82 ) ;
+ Size = MAP_APPFONT ( 141 , 8 ) ;
+ Text [ en-US ] = "Character Style for ruby text";
+ };
+ ListBox LB_CHAR_STYLE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_RUBY:LB_CHAR_STYLE";
+ Pos = MAP_APPFONT ( 80 , 93) ;
+ Size = MAP_APPFONT ( 89 , 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ PushButton PB_STYLIST
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_RUBY:PB_STYLIST";
+ Pos = MAP_APPFONT ( 171 , 92 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Styles";
+ };
+ FixedText FT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6, 110 ) ;
+ Size = MAP_APPFONT ( 195 , 8 ) ;
+ Text [ en-US ] = "Preview:";
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 121 ) ;
+ Size = MAP_APPFONT ( 215 , 50 ) ;
+ Border = TRUE ;
+ };
+ OKButton PB_APPLY
+ {
+ DefButton = TRUE;
+ Pos = MAP_APPFONT ( 65 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Apply";
+ };
+ PushButton PB_CLOSE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_RUBY:PB_CLOSE";
+ Pos = MAP_APPFONT ( 118, 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Close";
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 171 , 175 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
diff --git a/svx/source/dialog/ruler.hrc b/svx/source/dialog/ruler.hrc
new file mode 100644
index 000000000000..1280b1237bc5
--- /dev/null
+++ b/svx/source/dialog/ruler.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+//!! Abhaegigkeit zu sv.hxx
+#define ID_MM 1
+#define ID_CM 2
+#define ID_M 3
+#define ID_KM 4
+#define ID_INCH 8
+#define ID_FOOT 9
+#define ID_MILE 10
+#define ID_POINT 6
+#define ID_PICA 7
+
diff --git a/svx/source/dialog/ruler.src b/svx/source/dialog/ruler.src
new file mode 100644
index 000000000000..4d0218f525ee
--- /dev/null
+++ b/svx/source/dialog/ruler.src
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+#include "ruler.hrc"
+
+Menu RID_SVXMN_RULER
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = ID_MM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Millimeter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_CM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Centimeter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_M ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Meter" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_KM ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Kilometer" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_INCH ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Inch" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_FOOT ;
+ Checkable = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fuß : Fu˜ */
+ /* ### ACHTUNG: Neuer Text in Resource? Fuß : Fu˜ */
+ Text [ en-US ] = "Foot" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_MILE ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Miles" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_POINT ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Point" ;
+ };
+ MenuItem
+ {
+ Identifier = ID_PICA ;
+ Checkable = TRUE ;
+ Text [ en-US ] = "Pica" ;
+ };
+ };
+};
+String RID_SVXSTR_RULER_TAB_LEFT
+{
+ Text [ en-US ] = "Left" ;
+};
+String RID_SVXSTR_RULER_TAB_RIGHT
+{
+ Text [ en-US ] = "Right" ;
+};
+String RID_SVXSTR_RULER_TAB_DECIMAL
+{
+ Text [ en-US ] = "Decimal" ;
+};
+String RID_SVXSTR_RULER_TAB_CENTER
+{
+ Text [ en-US ] = "Center" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx
new file mode 100644
index 000000000000..fa6936e7581e
--- /dev/null
+++ b/svx/source/dialog/rulritem.cxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/string.hxx>
+
+#include <svx/dialogs.hrc>
+#include "svx/rulritem.hxx"
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/frame/status/LeftRightMargin.hpp>
+#include <com/sun/star/frame/status/UpperLowerMargin.hpp>
+
+//------------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SvxPagePosSizeItem, SfxPoolItem);
+TYPEINIT1_AUTOFACTORY(SvxLongLRSpaceItem, SfxPoolItem);
+TYPEINIT1_AUTOFACTORY(SvxLongULSpaceItem, SfxPoolItem);
+TYPEINIT1(SvxColumnItem, SfxPoolItem);
+TYPEINIT1(SvxObjectItem, SfxPoolItem);
+
+//------------------------------------------------------------------------
+
+int SvxLongLRSpaceItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ lLeft==((const SvxLongLRSpaceItem &)rCmp).lLeft &&
+ lRight==((const SvxLongLRSpaceItem &)rCmp).lRight;
+}
+
+
+//------------------------------------------------------------------------
+
+String SvxLongLRSpaceItem::GetValueText() const
+{
+ return String();
+}
+
+#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
+#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
+
+sal_Bool SvxLongLRSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch( nMemberId )
+ {
+ case 0:
+ {
+ ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
+ aLeftRightMargin.Left = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
+ aLeftRightMargin.Right = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
+ rVal <<= aLeftRightMargin;
+ return sal_True;
+ }
+
+ case MID_LEFT: nVal = lLeft; break;
+ case MID_RIGHT: nVal = lRight; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ if ( bConvert )
+ nVal = TWIP_TO_MM100( nVal );
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool SvxLongLRSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ ::com::sun::star::frame::status::LeftRightMargin aLeftRightMargin;
+ if ( rVal >>= aLeftRightMargin )
+ {
+ lLeft = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Left ) : aLeftRightMargin.Left;
+ lRight = bConvert ? MM100_TO_TWIP( aLeftRightMargin.Right ) : aLeftRightMargin.Right;
+ return sal_True;
+ }
+ }
+ else if ( rVal >>= nVal )
+ {
+ if ( bConvert )
+ nVal = MM100_TO_TWIP( nVal );
+
+ switch( nMemberId )
+ {
+ case MID_LEFT: lLeft = nVal; break;
+ case MID_RIGHT: lRight = nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxLongLRSpaceItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxLongLRSpaceItem::Clone(SfxItemPool *) const
+{
+ return new SvxLongLRSpaceItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem(long lL, long lR, sal_uInt16 nId)
+ : SfxPoolItem(nId),
+ lLeft(lL),
+ lRight(lR)
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem() :
+ SfxPoolItem( 0 ),
+ lLeft( 0 ),
+ lRight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongLRSpaceItem::SvxLongLRSpaceItem(const SvxLongLRSpaceItem &rCpy)
+ : SfxPoolItem(rCpy),
+ lLeft(rCpy.lLeft),
+ lRight(rCpy.lRight)
+ {}
+
+//------------------------------------------------------------------------
+
+int SvxLongULSpaceItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ lLeft==((const SvxLongULSpaceItem &)rCmp).lLeft &&
+ lRight==((const SvxLongULSpaceItem &)rCmp).lRight;
+}
+
+
+//------------------------------------------------------------------------
+
+String SvxLongULSpaceItem::GetValueText() const
+{
+ return String();
+}
+
+sal_Bool SvxLongULSpaceItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch( nMemberId )
+ {
+ case 0:
+ {
+ ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
+ aUpperLowerMargin.Upper = bConvert ? TWIP_TO_MM100( lLeft ) : lLeft;
+ aUpperLowerMargin.Lower = bConvert ? TWIP_TO_MM100( lRight ) : lRight;
+ rVal <<= aUpperLowerMargin;
+ return sal_True;
+ }
+
+ case MID_UPPER: nVal = lLeft; break;
+ case MID_LOWER: nVal = lRight; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ if ( bConvert )
+ nVal = TWIP_TO_MM100( nVal );
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+sal_Bool SvxLongULSpaceItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ ::com::sun::star::frame::status::UpperLowerMargin aUpperLowerMargin;
+ if ( rVal >>= aUpperLowerMargin )
+ {
+ lLeft = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Upper ) : aUpperLowerMargin.Upper;
+ lRight = bConvert ? MM100_TO_TWIP( aUpperLowerMargin.Lower ) : aUpperLowerMargin.Lower;
+ return sal_True;
+ }
+ }
+ else if ( rVal >>= nVal )
+ {
+ if ( bConvert )
+ nVal = MM100_TO_TWIP( nVal );
+
+ switch( nMemberId )
+ {
+ case MID_UPPER: lLeft = nVal; break;
+ case MID_LOWER: lRight = nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxLongULSpaceItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxLongULSpaceItem::Clone(SfxItemPool *) const
+{
+ return new SvxLongULSpaceItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem(long lL, long lR, sal_uInt16 nId)
+ : SfxPoolItem(nId),
+ lLeft(lL),
+ lRight(lR)
+{}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem(const SvxLongULSpaceItem &rCpy)
+ : SfxPoolItem(rCpy),
+ lLeft(rCpy.lLeft),
+ lRight(rCpy.lRight)
+ {}
+
+//------------------------------------------------------------------------
+
+SvxLongULSpaceItem::SvxLongULSpaceItem() :
+ SfxPoolItem( 0 ),
+ lLeft( 0 ),
+ lRight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+int SvxPagePosSizeItem::operator==( const SfxPoolItem& rCmp) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ aPos == ((const SvxPagePosSizeItem &)rCmp).aPos &&
+ lWidth == ((const SvxPagePosSizeItem &)rCmp).lWidth &&
+ lHeight == ((const SvxPagePosSizeItem &)rCmp).lHeight;
+}
+
+sal_Bool SvxPagePosSizeItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ com::sun::star::awt::Rectangle aPagePosSize;
+ aPagePosSize.X = aPos.X();
+ aPagePosSize.Y = aPos.Y();
+ aPagePosSize.Width = lWidth;
+ aPagePosSize.Height = lHeight;
+ rVal <<= aPagePosSize;
+ return sal_True;
+ }
+
+ case MID_X: nVal = aPos.X(); break;
+ case MID_Y: nVal = aPos.Y(); break;
+ case MID_WIDTH: nVal = lWidth; break;
+ case MID_HEIGHT: nVal = lHeight; break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ rVal <<= nVal;
+ return sal_True;
+}
+
+sal_Bool SvxPagePosSizeItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+
+ sal_Int32 nVal = 0;
+ if ( nMemberId == 0 )
+ {
+ com::sun::star::awt::Rectangle aPagePosSize;
+ if ( rVal >>= aPagePosSize )
+ {
+ aPos.X() = aPagePosSize.X;
+ aPos.Y() = aPagePosSize.Y;
+ lWidth = aPagePosSize.Width;
+ lHeight = aPagePosSize.Height;
+ return sal_True;
+ }
+ else
+ return sal_False;
+ }
+ else if ( rVal >>= nVal )
+ {
+ switch ( nMemberId )
+ {
+ case MID_X: aPos.X() = nVal; break;
+ case MID_Y: aPos.Y() = nVal; break;
+ case MID_WIDTH: lWidth = nVal; break;
+ case MID_HEIGHT: lHeight = nVal; break;
+
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------
+
+String SvxPagePosSizeItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxPagePosSizeItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxPagePosSizeItem::Clone(SfxItemPool *) const
+{
+ return new SvxPagePosSizeItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem(const Point &rP, long lW, long lH)
+ : SfxPoolItem(SID_RULER_PAGE_POS),
+ aPos(rP),
+ lWidth(lW),
+ lHeight(lH)
+{}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem(const SvxPagePosSizeItem &rCpy)
+ : SfxPoolItem(rCpy),
+ aPos(rCpy.aPos),
+ lWidth(rCpy.lWidth),
+ lHeight(rCpy.lHeight)
+ {}
+
+//------------------------------------------------------------------------
+
+SvxPagePosSizeItem::SvxPagePosSizeItem()
+ : SfxPoolItem( 0 ),
+ aPos( 0, 0 ),
+ lWidth( 0 ),
+ lHeight( 0 )
+{}
+
+//------------------------------------------------------------------------
+
+void SvxColumnItem::DeleteAndDestroyColumns()
+{
+ for( sal_uInt16 i = aColumns.Count(); i>0; )
+ {
+ SvxColumnDescription *pTmp = (SvxColumnDescription *)aColumns[--i];
+ aColumns.Remove( i );
+ delete pTmp;
+ }
+}
+
+//------------------------------------------------------------------------
+
+int SvxColumnItem::operator==(const SfxPoolItem& rCmp) const
+{
+ if(!SfxPoolItem::operator==(rCmp) ||
+ nActColumn != ((const SvxColumnItem&)rCmp).nActColumn ||
+ nLeft != ((const SvxColumnItem&)rCmp).nLeft ||
+ nRight != ((const SvxColumnItem&)rCmp).nRight ||
+ bTable != ((const SvxColumnItem&)rCmp).bTable ||
+ Count() != ((const SvxColumnItem&)rCmp).Count())
+ return sal_False;
+
+ const sal_uInt16 nCount = ((const SvxColumnItem&)rCmp).Count();
+ for(sal_uInt16 i = 0; i < nCount;++i) {
+#if OSL_DEBUG_LEVEL > 1
+ SvxColumnDescription *p1, *p2;
+ p1 = (SvxColumnDescription *)aColumns[i];
+ p2 = (SvxColumnDescription *)((const SvxColumnItem&)rCmp).aColumns[i];
+#endif
+ if( (*this)[i] != ((const SvxColumnItem&)rCmp)[i] )
+ return sal_False;
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+String SvxColumnItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxColumnItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxColumnItem::Clone( SfxItemPool * ) const
+{
+ return new SvxColumnItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( sal_uInt16 nAct ) :
+
+ SfxPoolItem( SID_RULER_BORDERS ),
+
+ nLeft ( 0 ),
+ nRight ( 0 ),
+ nActColumn ( nAct ),
+ bTable ( sal_False ),
+ bOrtho (sal_True )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( sal_uInt16 nActCol, sal_uInt16 left, sal_uInt16 right ) :
+
+ SfxPoolItem( SID_RULER_BORDERS ),
+
+ nLeft ( left ),
+ nRight ( right ),
+ nActColumn ( nActCol ),
+ bTable ( sal_True ),
+ bOrtho ( sal_True )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::SvxColumnItem( const SvxColumnItem& rCopy ) :
+
+ SfxPoolItem( rCopy ),
+
+ aColumns ( (sal_uInt8)rCopy.Count() ),
+ nLeft ( rCopy.nLeft ),
+ nRight ( rCopy.nRight ),
+ nActColumn( rCopy.nActColumn ),
+ bTable ( rCopy.bTable ),
+ bOrtho ( rCopy.bOrtho )
+
+{
+ const sal_uInt16 nCount = rCopy.Count();
+
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ Append( rCopy[i] );
+}
+
+//------------------------------------------------------------------------
+
+SvxColumnItem::~SvxColumnItem()
+{
+ DeleteAndDestroyColumns();
+}
+
+//------------------------------------------------------------------------
+
+const SvxColumnItem &SvxColumnItem::operator=(const SvxColumnItem &rCopy)
+{
+ nLeft = rCopy.nLeft;
+ nRight = rCopy.nRight;
+ bTable = rCopy.bTable;
+ nActColumn = rCopy.nActColumn;
+ DeleteAndDestroyColumns();
+ const sal_uInt16 nCount = rCopy.Count();
+ for(sal_uInt16 i = 0; i < nCount;++i)
+ Insert(rCopy[i], i);
+ return *this;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxColumnItem::CalcOrtho() const
+{
+ const sal_uInt16 nCount = Count();
+ DBG_ASSERT(nCount >= 2, "keine Spalten");
+ if(nCount < 2)
+ return sal_False;
+
+ long nColWidth = (*this)[0].GetWidth();
+ for(sal_uInt16 i = 1; i < nCount; ++i) {
+ if( (*this)[i].GetWidth() != nColWidth)
+ return sal_False;
+ }
+ //!! Breite Trenner
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+long SvxColumnItem::GetVisibleRight() const
+{
+ sal_uInt16 nIdx = 0;
+
+ for ( sal_uInt16 i = 0; i < nActColumn; ++i )
+ {
+ if ( (*this)[i].bVisible )
+ ++nIdx;
+ }
+ return (*this)[nIdx].nEnd;
+}
+
+sal_Bool SvxColumnItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_COLUMNARRAY:
+ {
+ return sal_False;
+ }
+ case MID_RIGHT: rVal <<= nRight; break;
+ case MID_LEFT: rVal <<= nLeft; break;
+ case MID_ORTHO: rVal <<= (sal_Bool) bOrtho; break;
+ case MID_ACTUAL: rVal <<= (sal_Int32) nActColumn; break;
+ case MID_TABLE: rVal <<= (sal_Bool) bTable; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxColumnItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Int32 nVal = 0;
+ switch ( nMemberId )
+ {
+ case MID_COLUMNARRAY:
+ {
+ return sal_False;
+ }
+ case MID_RIGHT: rVal >>= nRight; break;
+ case MID_LEFT: rVal >>= nLeft; break;
+ case MID_ORTHO: rVal >>= nVal; bOrtho = (sal_Bool) nVal; break;
+ case MID_ACTUAL: rVal >>= nVal; nActColumn = (sal_uInt16) nVal; break;
+ case MID_TABLE: rVal >>= nVal; bTable = (sal_Bool) nVal; break;
+ default: DBG_ERROR("Wrong MemberId!"); return sal_False;
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+int SvxObjectItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ return SfxPoolItem::operator==(rCmp) &&
+ nStartX == ((const SvxObjectItem&)rCmp).nStartX &&
+ nEndX == ((const SvxObjectItem&)rCmp).nEndX &&
+ nStartY == ((const SvxObjectItem&)rCmp).nStartY &&
+ nEndY == ((const SvxObjectItem&)rCmp).nEndY &&
+ bLimits == ((const SvxObjectItem&)rCmp).bLimits;
+}
+
+//------------------------------------------------------------------------
+
+String SvxObjectItem::GetValueText() const
+{
+ return String();
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxObjectItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/, const IntlWrapper *
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxObjectItem::Clone(SfxItemPool *) const
+{
+ return new SvxObjectItem(*this);
+}
+
+//------------------------------------------------------------------------
+
+SvxObjectItem::SvxObjectItem( long nSX, long nEX,
+ long nSY, long nEY, sal_Bool limits ) :
+
+ SfxPoolItem( SID_RULER_OBJECT ),
+
+ nStartX ( nSX ),
+ nEndX ( nEX ),
+ nStartY ( nSY ),
+ nEndY ( nEY ),
+ bLimits ( limits )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxObjectItem::SvxObjectItem( const SvxObjectItem& rCopy ) :
+
+ SfxPoolItem( rCopy ),
+
+ nStartX ( rCopy.nStartX ),
+ nEndX ( rCopy.nEndX ),
+ nStartY ( rCopy.nStartY ),
+ nEndY ( rCopy.nEndY ),
+ bLimits ( rCopy.bLimits )
+
+{
+}
+
+sal_Bool SvxObjectItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_START_X : rVal <<= nStartX; break;
+ case MID_START_Y : rVal <<= nStartY; break;
+ case MID_END_X : rVal <<= nEndX; break;
+ case MID_END_Y : rVal <<= nEndY; break;
+ case MID_LIMIT : rVal <<= bLimits; break;
+ default:
+ DBG_ERROR( "Wrong MemberId" );
+ return sal_False;
+ }
+
+ return sal_True;
+}
+
+sal_Bool SvxObjectItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet=sal_False;
+ switch ( nMemberId )
+ {
+ case MID_START_X : bRet = (rVal >>= nStartX); break;
+ case MID_START_Y : bRet = (rVal >>= nStartY); break;
+ case MID_END_X : bRet = (rVal >>= nEndX); break;
+ case MID_END_Y : bRet = (rVal >>= nEndY); break;
+ case MID_LIMIT : bRet = (rVal >>= bLimits); break;
+ default: DBG_ERROR( "Wrong MemberId" );
+ }
+
+ return bRet;
+}
+
diff --git a/svx/source/dialog/sdstring.src b/svx/source/dialog/sdstring.src
new file mode 100644
index 000000000000..4b70dda6a151
--- /dev/null
+++ b/svx/source/dialog/sdstring.src
@@ -0,0 +1,1289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ------------------------------------------------------------------
+#include <svx/dialogs.hrc>
+ // pragma -------------------------------------------------------------------
+
+ // Strings fuer die Draw-Dialoge --------------------------------------------
+String RID_SVXSTR_SOLID
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Durchgängig : Durchgõngig */
+ /* ### ACHTUNG: Neuer Text in Resource? Durchgängig : Durchgõngig */
+ Text [ en-US ] = "Continuous" ;
+};
+String RID_SVXSTR_GRADIENT
+{
+ Text [ en-US ] = "Gradient" ;
+};
+String RID_SVXSTR_BITMAP
+{
+ Text [ en-US ] = "Bitmap" ;
+};
+String RID_SVXSTR_LINESTYLE
+{
+ Text [ en-US ] = "Line Style" ;
+};
+String RID_SVXSTR_INVISIBLE
+{
+ Text [ en-US ] = "Invisible" ;
+};
+String RID_SVXSTR_COLOR
+{
+ Text [ en-US ] = "Color" ;
+};
+String RID_SVXSTR_HATCH
+{
+ Text [ en-US ] = "Hatching" ;
+};
+String RID_SVXSTR_LINEEND
+{
+ Text [ en-US ] = "Arrowheads" ;
+};
+
+String RID_SVXSTR_CLOSE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */
+ /* ### ACHTUNG: Neuer Text in Resource? Schließen : Schlie˜en */
+ Text [ en-US ] = "Close" ;
+};
+String RID_SVXSTR_BLACK
+{
+ Text [ en-US ] = "Black" ;
+};
+String RID_SVXSTR_BLUE
+{
+ Text [ en-US ] = "Blue" ;
+};
+String RID_SVXSTR_GREEN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Grün : Gr³n */
+ /* ### ACHTUNG: Neuer Text in Resource? Grün : Gr³n */
+ Text [ en-US ] = "Green" ;
+};
+String RID_SVXSTR_CYAN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Türkis : T³rkis */
+ /* ### ACHTUNG: Neuer Text in Resource? Türkis : T³rkis */
+ Text [ en-US ] = "Turquoise" ;
+};
+String RID_SVXSTR_RED
+{
+ Text [ en-US ] = "Red" ;
+};
+String RID_SVXSTR_MAGENTA
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Magenta : Violett */
+ Text [ en-US ] = "Magenta" ;
+};
+String RID_SVXSTR_BROWN
+{
+ Text [ en-US ] = "Brown" ;
+};
+String RID_SVXSTR_GREY
+{
+ Text [ en-US ] = "Gray" ;
+};
+String RID_SVXSTR_LIGHTGREY
+{
+ Text [ en-US ] = "Light gray" ;
+};
+String RID_SVXSTR_LIGHTBLUE
+{
+ Text [ en-US ] = "Light blue" ;
+};
+String RID_SVXSTR_LIGHTGREEN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Hellgrün : Hellgr³n */
+ /* ### ACHTUNG: Neuer Text in Resource? Hellgrün : Hellgr³n */
+ Text [ en-US ] = "Light green" ;
+};
+String RID_SVXSTR_LIGHTCYAN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Helltürkis : Hellt³rkis */
+ /* ### ACHTUNG: Neuer Text in Resource? Helltürkis : Hellt³rkis */
+ Text [ en-US ] = "Light cyan" ;
+};
+String RID_SVXSTR_LIGHTRED
+{
+ Text [ en-US ] = "Light red" ;
+};
+String RID_SVXSTR_LIGHTMAGENTA
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Hellmagenta : Hellviolett */
+ Text [ en-US ] = "Light magenta" ;
+};
+String RID_SVXSTR_YELLOW
+{
+ Text [ en-US ] = "Yellow" ;
+};
+String RID_SVXSTR_WHITE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Weiß : Wei˜ */
+ /* ### ACHTUNG: Neuer Text in Resource? Weiß : Wei˜ */
+ Text [ en-US ] = "White" ;
+};
+String RID_SVXSTR_BLUEGREY
+{
+ Text [ en-US ] = "Blue gray" ;
+};
+String RID_SVXSTR_ORANGE
+{
+ Text [ en-US ] = "Orange" ;
+};
+String RID_SVXSTR_ARROW
+{
+ Text [ en-US ] = "Arrow" ;
+};
+String RID_SVXSTR_SQUARE
+{
+ Text [ en-US ] = "Square" ;
+};
+String RID_SVXSTR_CIRCLE
+{
+ Text [ en-US ] = "Circle" ;
+};
+String RID_SVXSTR_NONE
+{
+ Text [ en-US ] = "- none -" ;
+};
+String RID_SVXSTR_TRANSPARENCE
+{
+ Text [ en-US ] = "Transparency" ;
+};
+String RID_SVXSTR_CENTERED
+{
+ Text [ en-US ] = "Centered" ;
+};
+String RID_SVXSTR_NOTCENTERED
+{
+ Text [ en-US ] = "Not centered" ;
+};
+String RID_SVXSTR_GRAFMODE_STANDARD
+{
+ Text [ en-US ] = "Default";
+};
+String RID_SVXSTR_GRAFMODE_GREYS
+{
+ Text [ en-US ] = "Grayscale";
+};
+String RID_SVXSTR_GRAFMODE_MONO
+{
+ Text [ en-US ] = "Black/White";
+};
+String RID_SVXSTR_GRAFMODE_WATERMARK
+{
+ Text [ en-US ] = "Watermark";
+};
+String STR_INSERT_VIDEO_EXTFILTER_IVF
+{
+ Text [ en-US ] = "Intel Indeo Video (*.ivf)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_AVI
+{
+ Text [ en-US ] = "Video for Windows (*.avi)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_MOV
+{
+ Text [ en-US ] = "QuickTime Movie (*.mov)" ;
+};
+
+String STR_INSERT_VIDEO_EXTFILTER_MPEG
+{
+ Text [ en-US ] = "MPEG - Motion Pictures Experts Group (*.mpe;*.mpeg;*.mpg)" ;
+};
+
+String STR_EXTFILTER_ALL
+{
+ Text [ en-US ] = "<All>" ;
+};
+
+String STR_INSERT_SOUND_TITLE
+{
+ Text [ en-US ] = "Insert sound" ;
+};
+
+String STR_INSERT_VIDEO_TITLE
+{
+ Text [ en-US ] = "Insert video" ;
+};
+
+
+// BM: some additional standard colors
+
+String RID_SVXSTR_VIOLET
+{
+ Text [ en-US ] = "Violet";
+};
+
+String RID_SVXSTR_BORDEAUX
+{
+ Text [ en-US ] = "Bordeaux";
+};
+
+String RID_SVXSTR_PALE_YELLOW
+{
+ Text [ en-US ] = "Pale yellow";
+};
+
+String RID_SVXSTR_PALE_GREEN
+{
+ Text [ en-US ] = "Pale green";
+};
+
+String RID_SVXSTR_DKVIOLET
+{
+ Text [ en-US ] = "Dark violet";
+};
+
+String RID_SVXSTR_SALMON
+{
+ Text [ en-US ] = "Salmon";
+};
+
+String RID_SVXSTR_SEABLUE
+{
+ Text [ en-US ] = "Sea blue";
+};
+
+String RID_SVXSTR_COLOR_SUN
+{
+ // attention: this is the color string for the Sun Microsystems specific colors !!!
+ Text [ en-US ] = "Sun" ;
+};
+
+String RID_SVXSTR_COLOR_CHART
+{
+ Text [ en-US ] = "Chart" ;
+};
+
+String RID_SVXSTR_TBLAFMT_3D
+{
+ Text [ en-US ] = "3D";
+};
+String RID_SVXSTR_TBLAFMT_BLACK1
+{
+ Text [ en-US ] = "Black 1";
+};
+String RID_SVXSTR_TBLAFMT_BLACK2
+{
+ Text [ en-US ] = "Black 2";
+};
+String RID_SVXSTR_TBLAFMT_BLUE
+{
+ Text [ en-US ] = "Blue";
+};
+String RID_SVXSTR_TBLAFMT_BROWN
+{
+ Text [ en-US ] = "Brown";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY
+{
+ Text [ en-US ] = "Currency";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_3D
+{
+ Text [ en-US ] = "Currency 3D";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_GRAY
+{
+ Text [ en-US ] = "Currency Gray";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER
+{
+ Text [ en-US ] = "Currency Lavender";
+};
+String RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE
+{
+ Text [ en-US ] = "Currency Turquoise";
+};
+String RID_SVXSTR_TBLAFMT_GRAY
+{
+ Text [ en-US ] = "Gray";
+};
+String RID_SVXSTR_TBLAFMT_GREEN
+{
+ Text [ en-US ] = "Green";
+};
+String RID_SVXSTR_TBLAFMT_LAVENDER
+{
+ Text [ en-US ] = "Lavender";
+};
+String RID_SVXSTR_TBLAFMT_RED
+{
+ Text [ en-US ] = "Red";
+};
+String RID_SVXSTR_TBLAFMT_TURQUOISE
+{
+ Text [ en-US ] = "Turquoise";
+};
+String RID_SVXSTR_TBLAFMT_YELLOW
+{
+ Text [ en-US ] = "Yellow";
+};
+
+String RID_SVXSTR_LINEJOINT_MIDDLE
+{
+ Text [ en-US ] = "Line joint averaged";
+};
+String RID_SVXSTR_LINEJOINT_BEVEL
+{
+ Text [ en-US ] = "Line joint bevel";
+};
+String RID_SVXSTR_LINEJOINT_MITER
+{
+ Text [ en-US ] = "Line joint miter";
+};
+String RID_SVXSTR_LINEJOINT_ROUND
+{
+ Text [ en-US ] = "Line joint round";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standardcolor-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BLACK_DEF
+{
+ Text = "Black" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BLUE_DEF
+{
+ Text = "Blue" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GREEN_DEF
+{
+ Text = "Green" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_CYAN_DEF
+{
+ Text = "Turquoise" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_RED_DEF
+{
+ Text = "Red" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_MAGENTA_DEF
+{
+ Text = "Magenta" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BROWN_DEF
+{
+ Text = "Brown" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GREY_DEF
+{
+ Text = "Gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTGREY_DEF
+{
+ Text = "Light gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTBLUE_DEF
+{
+ Text = "Light blue" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTGREEN_DEF
+{
+ Text = "Light green" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTCYAN_DEF
+{
+ Text = "Light cyan" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTRED_DEF
+{
+ Text = "Light red" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LIGHTMAGENTA_DEF
+{
+ Text = "Light magenta" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_YELLOW_DEF
+{
+ Text = "Yellow" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_WHITE_DEF
+{
+ Text = "White" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BLUEGREY_DEF
+{
+ Text = "Blue gray" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_ORANGE_DEF
+{
+ Text = "Orange" ;
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_VIOLET_DEF
+{
+ Text = "Violet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BORDEAUX_DEF
+{
+ Text = "Bordeaux";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_PALE_YELLOW_DEF
+{
+ Text = "Pale yellow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_PALE_GREEN_DEF
+{
+ Text = "Pale green";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DKVIOLET_DEF
+{
+ Text = "Dark violet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_SALMON_DEF
+{
+ Text = "Salmon";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_SEABLUE_DEF
+{
+ Text = "Sea blue";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_COLOR_SUN_DEF
+{
+ // attention: this is the color string for the Sun Microsystems specific colors !!!
+ Text = "Sun";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_COLOR_CHART_DEF
+{
+ Text = "Chart";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-gradient-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT0_DEF
+{
+ Text = "Gradient";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT1_DEF
+{
+ Text = "Linear blue/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT2_DEF
+{
+ Text = "Linear magenta/green";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT3_DEF
+{
+ Text = "Linear yellow/brown";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT4_DEF
+{
+ Text = "Radial green/black";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT5_DEF
+{
+ Text = "Radial red/yellow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT6_DEF
+{
+ Text = "Rectangular red/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT7_DEF
+{
+ Text = "Square yellow/white";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT8_DEF
+{
+ Text = "Ellipsoid blue grey/light blue";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_GRDT9_DEF
+{
+ Text = "Axial light red/white";
+};
+
+String RID_SVXSTR_GRDT0
+{
+ Text [ en-US ] = "Gradient";
+};
+String RID_SVXSTR_GRDT1
+{
+ Text [ en-US ] = "Linear blue/white";
+};
+String RID_SVXSTR_GRDT2
+{
+ Text [ en-US ] = "Linear magenta/green";
+};
+String RID_SVXSTR_GRDT3
+{
+ Text [ en-US ] = "Linear yellow/brown";
+};
+String RID_SVXSTR_GRDT4
+{
+ Text [ en-US ] = "Radial green/black";
+};
+String RID_SVXSTR_GRDT5
+{
+ Text [ en-US ] = "Radial red/yellow";
+};
+String RID_SVXSTR_GRDT6
+{
+ Text [ en-US ] = "Rectangular red/white";
+};
+String RID_SVXSTR_GRDT7
+{
+ Text [ en-US ] = "Square yellow/white";
+};
+String RID_SVXSTR_GRDT8
+{
+ Text [ en-US ] = "Ellipsoid blue gray/light blue";
+};
+String RID_SVXSTR_GRDT9
+{
+ Text [ en-US ] = "Axial light red/white";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-hatch-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH0_DEF
+{
+ Text = "Black 45 Degrees Wide";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH1_DEF
+{
+ Text = "Black 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH2_DEF
+{
+ Text = "Black -45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH3_DEF
+{
+ Text = "Black 90 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH4_DEF
+{
+ Text = "Red Crossed 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH5_DEF
+{
+ Text = "Red Crossed 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH6_DEF
+{
+ Text = "Blue Crossed 45 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH7_DEF
+{
+ Text = "Blue Crossed 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH8_DEF
+{
+ Text = "Blue Triple 90 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH9_DEF
+{
+ Text = "Black 0 Degrees";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_HATCH10_DEF
+{
+ Text = "Hatch";
+};
+
+String RID_SVXSTR_HATCH0
+{
+ Text [ en-US ] = "Black 45 degrees wide";
+};
+String RID_SVXSTR_HATCH1
+{
+ Text [ en-US ] = "Black 45 degrees";
+};
+String RID_SVXSTR_HATCH2
+{
+ Text [ en-US ] = "Black -45 degrees";
+};
+String RID_SVXSTR_HATCH3
+{
+ Text [ en-US ] = "Black 90 degrees";
+};
+String RID_SVXSTR_HATCH4
+{
+ Text [ en-US ] = "Red crossed 45 degrees";
+};
+String RID_SVXSTR_HATCH5
+{
+ Text [ en-US ] = "Red crossed 0 degrees";
+};
+String RID_SVXSTR_HATCH6
+{
+ Text [ en-US ] = "Blue crossed 45 degrees";
+};
+String RID_SVXSTR_HATCH7
+{
+ Text [ en-US ] = "Blue crossed 0 degrees";
+};
+String RID_SVXSTR_HATCH8
+{
+ Text [ en-US ] = "Blue triple 90 degrees";
+};
+String RID_SVXSTR_HATCH9
+{
+ Text [ en-US ] = "Black 0 degrees";
+};
+String RID_SVXSTR_HATCH10
+{
+ Text [ en-US ] = "Hatching" ;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-bitmap-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP0_DEF
+{
+ Text = "Empty";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP1_DEF
+{
+ Text = "Sky";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP2_DEF
+{
+ Text = "Aqua";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP3_DEF
+{
+ Text = "Coarse";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP4_DEF
+{
+ Text = "Space Metal";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP5_DEF
+{
+ Text = "Space";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP6_DEF
+{
+ Text = "Metal";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP7_DEF
+{
+ Text = "Wet";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP8_DEF
+{
+ Text = "Marble";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP9_DEF
+{
+ Text = "Linen";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP10_DEF
+{
+ Text = "Stone";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP11_DEF
+{
+ Text = "Pebbles";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP12_DEF
+{
+ Text = "Wall";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP13_DEF
+{
+ Text = "Red Wall";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP14_DEF
+{
+ Text = "Pattern";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP15_DEF
+{
+ Text = "Leaves";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP16_DEF
+{
+ Text = "Lawn Artificial";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP17_DEF
+{
+ Text = "Daisy";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP18_DEF
+{
+ Text = "Orange";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP19_DEF
+{
+ Text = "Fiery";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP20_DEF
+{
+ Text = "Roses";
+};
+
+/* nicht uebersetzen */
+String RID_SVXSTR_BMP21_DEF
+{
+ Text = "Bitmape";
+};
+
+String RID_SVXSTR_BMP0
+{
+ Text [ en-US ] = "Blank";
+};
+String RID_SVXSTR_BMP1
+{
+ Text [ en-US ] = "Sky";
+};
+String RID_SVXSTR_BMP2
+{
+ Text [ en-US ] = "Water";
+};
+String RID_SVXSTR_BMP3
+{
+ Text [ en-US ] = "Coarse grained";
+};
+String RID_SVXSTR_BMP4
+{
+ Text [ en-US ] = "Mercury";
+};
+String RID_SVXSTR_BMP5
+{
+ Text [ en-US ] = "Space";
+};
+String RID_SVXSTR_BMP6
+{
+ Text [ en-US ] = "Metal";
+};
+String RID_SVXSTR_BMP7
+{
+ Text [ en-US ] = "Droplets";
+};
+String RID_SVXSTR_BMP8
+{
+ Text [ en-US ] = "Marble";
+};
+String RID_SVXSTR_BMP9
+{
+ Text [ en-US ] = "Linen";
+};
+String RID_SVXSTR_BMP10
+{
+ Text [ en-US ] = "Stone";
+};
+String RID_SVXSTR_BMP11
+{
+ Text [ en-US ] = "Gravel";
+};
+String RID_SVXSTR_BMP12
+{
+ Text [ en-US ] = "Wall";
+};
+String RID_SVXSTR_BMP13
+{
+ Text [ en-US ] = "Brownstone";
+};
+String RID_SVXSTR_BMP14
+{
+ Text [ en-US ] = "Netting";
+};
+String RID_SVXSTR_BMP15
+{
+ Text [ en-US ] = "Leaves";
+};
+String RID_SVXSTR_BMP16
+{
+ Text [ en-US ] = "Artificial Turf";
+};
+String RID_SVXSTR_BMP17
+{
+ Text [ en-US ] = "Daisy";
+};
+String RID_SVXSTR_BMP18
+{
+ Text [ en-US ] = "Orange";
+};
+String RID_SVXSTR_BMP19
+{
+ Text [ en-US ] = "Fiery";
+};
+String RID_SVXSTR_BMP20
+{
+ Text [ en-US ] = "Roses";
+};
+
+String RID_SVXSTR_BMP21
+{
+ Text [ en-US ] = "Bitmap";
+};
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-dash-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH0_DEF
+{
+ Text = "Ultrafine Dashed";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH1_DEF
+{
+ Text = "Fine Dashed";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH2_DEF
+{
+ Text = "Ultrafine 2 Dots 3 Dashes";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH3_DEF
+{
+ Text = "Fine Dotted";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH4_DEF
+{
+ Text = "Line with Fine Dots";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH5_DEF
+{
+ Text = "Fine Dashed (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH6_DEF
+{
+ Text = "3 Dashes 3 Dots (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH7_DEF
+{
+ Text = "Ultrafine Dotted (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH8_DEF
+{
+ Text = "Line Style 9";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH9_DEF
+{
+ Text = "2 Dots 1 Dash";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH10_DEF
+{
+ Text = "Dashed (var)";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_DASH11_DEF
+{
+ Text = "Dash";
+};
+
+String RID_SVXSTR_DASH0
+{
+ Text [ en-US ] = "Ultrafine dashed";
+};
+String RID_SVXSTR_DASH1
+{
+ Text [ en-US ] = "Fine dashed";
+};
+String RID_SVXSTR_DASH2
+{
+ Text [ en-US ] = "Ultrafine 2 dots 3 dashes";
+};
+String RID_SVXSTR_DASH3
+{
+ Text [ en-US ] = "Fine dotted";
+};
+String RID_SVXSTR_DASH4
+{
+ Text [ en-US ] = "Line with fine dots";
+};
+String RID_SVXSTR_DASH5
+{
+ Text [ en-US ] = "Fine dashed (variable)";
+};
+String RID_SVXSTR_DASH6
+{
+ Text [ en-US ] = "3 dashes 3 dots (variable)";
+};
+String RID_SVXSTR_DASH7
+{
+ Text [ en-US ] = "Ultrafine dotted (variable)";
+};
+String RID_SVXSTR_DASH8
+{
+ Text [ en-US ] = "Line style 9";
+};
+String RID_SVXSTR_DASH9
+{
+ Text [ en-US ] = "2 dots 1 dash";
+};
+String RID_SVXSTR_DASH10
+{
+ Text [ en-US ] = "Dashed (variable)";
+};
+String RID_SVXSTR_DASH11
+{
+ Text [ en-US ] = "Dashed";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard-line-end-table
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND0_DEF
+{
+ Text = "Arrow concave";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND1_DEF
+{
+ Text = "Square 45";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND2_DEF
+{
+ Text = "Small Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND3_DEF
+{
+ Text = "Dimension Lines";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND4_DEF
+{
+ Text = "Double Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND5_DEF
+{
+ Text = "Rounded short Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND6_DEF
+{
+ Text = "Symmetric Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND7_DEF
+{
+ Text = "Line Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND8_DEF
+{
+ Text = "Rounded large Arrow";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND9_DEF
+{
+ Text = "Circle";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND10_DEF
+{
+ Text = "Square";
+};
+/* nicht uebersetzen */
+String RID_SVXSTR_LEND11_DEF
+{
+ Text = "Arrow";
+};
+
+String RID_SVXSTR_LEND0
+{
+ Text [ en-US ] = "Arrow concave";
+};
+String RID_SVXSTR_LEND1
+{
+ Text [ en-US ] = "Square 45";
+};
+String RID_SVXSTR_LEND2
+{
+ Text [ en-US ] = "Small arrow";
+};
+String RID_SVXSTR_LEND3
+{
+ Text [ en-US ] = "Dimension lines";
+};
+String RID_SVXSTR_LEND4
+{
+ Text [ en-US ] = "Double Arrow";
+};
+String RID_SVXSTR_LEND5
+{
+ Text [ en-US ] = "Rounded short arrow";
+};
+String RID_SVXSTR_LEND6
+{
+ Text [ en-US ] = "Symmetric arrow";
+};
+String RID_SVXSTR_LEND7
+{
+ Text [ en-US ] = "Line arrow";
+};
+String RID_SVXSTR_LEND8
+{
+ Text [ en-US ] = "Rounded large arrow";
+};
+String RID_SVXSTR_LEND9
+{
+ Text [ en-US ] = "Circle";
+};
+String RID_SVXSTR_LEND10
+{
+ Text [ en-US ] = "Square";
+};
+String RID_SVXSTR_LEND11
+{
+ Text [ en-US ] = "Arrow";
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Reference-strings for standard transparence gradients
+//
+
+/* nicht uebersetzen */
+String RID_SVXSTR_TRASNGR0_DEF
+{
+ Text = "Transparency";
+};
+
+String RID_SVXSTR_TRASNGR0
+{
+ Text [ en-US ] = "Transparency";
+};
+
+ // ********************************************************************** EOF
+
+ // RID_SVXSTR_FIELDUNIT_TABLE --------------------------------------------
+
+StringArray RID_SVXSTR_FIELDUNIT_TABLE
+{
+ ItemList [ en-US ] =
+ {
+ < "Millimeter" ; FUNIT_MM ; > ;
+ < "Centimeter" ; FUNIT_CM ; > ;
+ < "Meter" ; FUNIT_M ; > ;
+ < "Kilometer" ; FUNIT_KM ; > ;
+ < "Inch" ; FUNIT_INCH ; > ;
+ < "Foot" ; FUNIT_FOOT ; > ;
+ < "Miles" ; FUNIT_MILE ; > ;
+ < "Pica" ; FUNIT_PICA ; > ;
+ < "Point" ; FUNIT_POINT ; > ;
+ };
+ };
+
+// unbekannte Zeichenfarbe
+String RID_SVXSTR_COLOR_USER
+{
+ Text [ en-US ] = "User" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/svx/source/dialog/sendreportgen.cxx b/svx/source/dialog/sendreportgen.cxx
new file mode 100644
index 000000000000..00295556164f
--- /dev/null
+++ b/svx/source/dialog/sendreportgen.cxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "docrecovery.hxx"
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ return false;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ return false;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ return false;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx
new file mode 100644
index 000000000000..d59bc9bb1cba
--- /dev/null
+++ b/svx/source/dialog/sendreportunx.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "docrecovery.hxx"
+#include "osl/file.hxx"
+#include "rtl/bootstrap.hxx"
+#include "rtl/strbuf.hxx"
+#include "tools/appendunixshellword.hxx"
+#include <string>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#define RCFILE ".crash_reportrc"
+
+using namespace ::std;
+
+static const char *get_home_dir()
+{
+ struct passwd *ppwd = getpwuid( getuid() );
+
+ return ppwd ? (ppwd->pw_dir ? ppwd->pw_dir : "/") : "/";
+}
+
+static bool read_line( FILE *fp, string& rLine )
+{
+ char szBuffer[1024];
+ bool bSuccess = false;
+ bool bEOL = false;
+ string line;
+
+
+ while ( !bEOL && fgets( szBuffer, sizeof(szBuffer), fp ) )
+ {
+ int len = strlen(szBuffer);
+
+ bSuccess = true;
+
+ while ( len && szBuffer[len - 1] == '\n' )
+ {
+ szBuffer[--len] = 0;
+ bEOL = true;
+ }
+
+ line.append( szBuffer );
+ }
+
+ rLine = line;
+ return bSuccess;
+}
+
+static string trim_string( const string& rString )
+{
+ string temp = rString;
+
+ while ( temp.length() && (temp[0] == ' ' || temp[0] == '\t') )
+ temp.erase( 0, 1 );
+
+ string::size_type len = temp.length();
+
+ while ( len && (temp[len-1] == ' ' || temp[len-1] == '\t') )
+ {
+ temp.erase( len - 1, 1 );
+ len = temp.length();
+ }
+
+ return temp;
+}
+
+static string get_profile_string( const char *pFileName, const char *pSectionName, const char *pKeyName, const char *pDefault = NULL )
+{
+ FILE *fp = fopen( pFileName, "r" );
+ string retValue = pDefault ? pDefault : "";
+
+ if ( fp )
+ {
+ string line;
+ string section;
+
+ while ( read_line( fp, line ) )
+ {
+ line = trim_string( line );
+
+ if ( line.length() && line[0] == '[' )
+ {
+ line.erase( 0, 1 );
+ string::size_type end = line.find( ']', 0 );
+
+ if ( string::npos != end )
+ section = trim_string( line.substr( 0, end ) );
+ }
+ else
+ {
+
+ string::size_type iEqualSign = line.find( '=', 0 );
+
+ if ( iEqualSign != string::npos )
+ {
+ string keyname = line.substr( 0, iEqualSign );
+ keyname = trim_string( keyname );
+
+ string value = line.substr( iEqualSign + 1, string::npos );
+ value = trim_string( value );
+
+ if (
+ 0 == strcasecmp( section.c_str(), pSectionName ) &&
+ 0 == strcasecmp( keyname.c_str(), pKeyName )
+ )
+ {
+ retValue = value;
+ break;
+ }
+ }
+ }
+ }
+
+ fclose( fp );
+ }
+
+ return retValue;
+}
+
+static bool get_profile_bool( const char *pFileName, const char *pSectionName, const char *pKeyName )
+{
+ string str = get_profile_string( pFileName, pSectionName, pKeyName );
+
+ if ( !strcasecmp( str.c_str(), "true" ) )
+ return true;
+ return false;
+}
+
+static String get_profile_String( const char *pFileName, const char *pSectionName, const char *pKeyName, const char * = NULL )
+{
+ string str = get_profile_string( pFileName, pSectionName, pKeyName );
+ String result( str.c_str(), RTL_TEXTENCODING_UTF8 );
+
+ return result;
+}
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ string sRCFile = get_home_dir();
+
+ sRCFile += "/";
+ sRCFile += string(RCFILE);
+
+ maEMailAddrED.SetText( get_profile_String( sRCFile.c_str(), "Options", "ReturnAddress" ) );
+ maParams.maHTTPProxyServer = get_profile_String( sRCFile.c_str(), "Options", "ProxyServer" );
+ maParams.maHTTPProxyPort = get_profile_String( sRCFile.c_str(), "Options", "ProxyPort" );
+ maParams.miHTTPConnectionType = get_profile_bool( sRCFile.c_str(), "Options", "UseProxy" ) ? 2 : 1;
+ maContactCB.Check( get_profile_bool( sRCFile.c_str(), "Options", "AllowContact" ) );
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ bool success = false;
+ string sRCFile = get_home_dir();
+
+ sRCFile += "/";
+ sRCFile += string(RCFILE);
+
+ FILE *fp = fopen( sRCFile.c_str(), "w" );
+
+ if ( fp )
+ {
+ fprintf( fp, "[Options]\n" );
+ fprintf( fp, "UseProxy=%s\n", 2 == maParams.miHTTPConnectionType ? "true" : "false" );
+ fprintf( fp, "ProxyServer=%s\n", ByteString( maParams.maHTTPProxyServer, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "ProxyPort=%s\n", ByteString( maParams.maHTTPProxyPort, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "ReturnAddress=%s\n", ByteString( GetEMailAddress(), RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ fprintf( fp, "AllowContact=%s\n", IsContactAllowed() ? "true" : "false" );
+ fclose( fp );
+ }
+
+ return success;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ ByteString strSubject( GetDocType(), RTL_TEXTENCODING_UTF8 );
+
+#if defined( LINUX ) || defined (MACOSX )
+ setenv( "ERRORREPORT_SUBJECT", strSubject.GetBuffer(), 1 );
+#else
+ static ::rtl::OString strEnvSubject = "ERRORREPORT_SUBJECT";
+ strEnvSubject += "=";
+ strEnvSubject += strSubject.GetBuffer();
+ putenv( (char *)strEnvSubject.getStr() );
+#endif
+
+ char szBodyFile[L_tmpnam] = "";
+ FILE *fp = fopen( tmpnam( szBodyFile ), "w" );
+
+ if ( fp )
+ {
+ ByteString strUTF8( GetUsing(), RTL_TEXTENCODING_UTF8 );
+
+ fwrite( strUTF8.GetBuffer(), 1, strUTF8.Len(), fp );
+ fclose( fp );
+#if defined( LINUX ) || defined (MACOSX)
+ setenv( "ERRORREPORT_BODYFILE", szBodyFile, 1 );
+#else
+ static ::rtl::OString strEnvBodyFile = "ERRORREPORT_BODYFILE";
+ strEnvBodyFile += "=";
+ strEnvBodyFile += szBodyFile;
+ putenv( (char *)strEnvBodyFile.getStr() );
+#endif
+ }
+
+ int ret = -1;
+ rtl::OUString path1(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "$BRAND_BASE_DIR/program/crashrep"));
+ rtl::Bootstrap::expandMacros(path1);
+ rtl::OString path2;
+ if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
+ osl::FileBase::E_None) &&
+ path1.convertToString(
+ &path2, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ rtl::OStringBuffer cmd;
+ tools::appendUnixShellWord(&cmd, path2);
+ cmd.append(RTL_CONSTASCII_STRINGPARAM(" -debug -load -send -noui"));
+ ret = system(cmd.getStr());
+ }
+
+ if ( szBodyFile[0] )
+ {
+ unlink( szBodyFile );
+ }
+
+ return -1 != ret;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/sendreportw32.cxx b/svx/source/dialog/sendreportw32.cxx
new file mode 100644
index 000000000000..7d15a0e2c65e
--- /dev/null
+++ b/svx/source/dialog/sendreportw32.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#define UNICODE
+#define _UNICODE
+
+#include <tools/svwin.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <tchar.h>
+#include <stdio.h>
+#include <systools/win32/uwinapi.h>
+
+// need to undef min and max macros from MS headers here to make
+// the std::min and std::max from stl visible again
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+
+#include "docrecovery.hxx"
+
+//***************************************************************************
+
+static LONG RegReadValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPVOID lpData, DWORD cbData )
+{
+ HKEY hKey = NULL;
+ LONG lResult;
+
+ lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
+
+ if ( ERROR_SUCCESS == lResult )
+ {
+ lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)lpData, &cbData );
+ RegCloseKey( hKey );
+ }
+
+ return lResult;
+}
+
+//***************************************************************************
+
+static LONG RegWriteValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData )
+{
+ HKEY hKey = NULL;
+ LONG lResult;
+
+ lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
+
+ if ( ERROR_SUCCESS == lResult )
+ {
+ lResult = RegSetValueEx( hKey, lpValueName, NULL, dwType, (CONST sal_uInt8 *)lpData, cbData );
+ RegCloseKey( hKey );
+ }
+
+ return lResult;
+}
+
+//***************************************************************************
+
+namespace svx{
+ namespace DocRecovery{
+
+ bool ErrorRepSendDialog::ReadParams()
+ {
+ _TCHAR szBuffer[2048];
+
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyServer"),
+ szBuffer,
+ sizeof(szBuffer) ) )
+ maParams.maHTTPProxyServer = (sal_Unicode *)szBuffer;
+
+ DWORD dwProxyPort;
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyPort"),
+ &dwProxyPort,
+ sizeof(dwProxyPort) ) )
+ {
+ _stprintf( szBuffer, _T("%d"), dwProxyPort );
+ maParams.maHTTPProxyPort = (sal_Unicode *)szBuffer;
+ }
+
+ if ( ERROR_SUCCESS == RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("ReturnAddress"),
+ szBuffer,
+ sizeof(szBuffer) ) )
+ maEMailAddrED.SetText( (sal_Unicode *)szBuffer );
+
+ DWORD fAllowContact = sal_False;
+ RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("AllowContact"),
+ &fAllowContact,
+ sizeof(fAllowContact) );
+ maContactCB.Check( (sal_Bool)fAllowContact );
+
+ DWORD uInternetConnection = 0;
+ RegReadValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPConnection"),
+ &uInternetConnection,
+ sizeof(uInternetConnection) );
+ maParams.miHTTPConnectionType = uInternetConnection;
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SaveParams()
+ {
+ const _TCHAR *lpHTTPProxyServer = reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyServer.GetBuffer());
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyServer"), REG_SZ,
+ lpHTTPProxyServer,
+ sizeof(TCHAR) * (_tcslen(lpHTTPProxyServer) + 1) );
+
+ _TCHAR* endptr = NULL;
+ DWORD dwProxyPort = _tcstoul( reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyPort.GetBuffer()), &endptr, 10 );
+
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPProxyPort"), REG_DWORD,
+ &dwProxyPort,
+ sizeof(DWORD) );
+
+ DWORD fAllowContact = IsContactAllowed();
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("AllowContact"), REG_DWORD,
+ &fAllowContact,
+ sizeof(DWORD) );
+
+
+ DWORD uInternetConnection = maParams.miHTTPConnectionType;
+
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("HTTPConnection"), REG_DWORD,
+ &uInternetConnection,
+ sizeof(DWORD) );
+
+ const _TCHAR *lpEmail = reinterpret_cast<LPCTSTR>(GetEMailAddress().GetBuffer());
+ RegWriteValue(
+ HKEY_CURRENT_USER,
+ TEXT("SOFTWARE\\OpenOffice.org\\CrashReport"),
+ TEXT("ReturnAddress"), REG_SZ,
+ lpEmail,
+ sizeof(TCHAR) * (_tcslen(lpEmail) + 1) );
+
+ return true;
+ }
+
+ bool ErrorRepSendDialog::SendReport()
+ {
+ TCHAR szTempPath[MAX_PATH];
+ TCHAR szFileName[MAX_PATH];
+
+ GetTempPath( elementsof(szTempPath), szTempPath );
+ GetTempFileName( szTempPath, TEXT("DSC"), 0, szFileName );
+
+ FILE *fp = _tfopen( szFileName, _T("wb") );
+
+ if ( fp )
+ {
+ ByteString strUTF8( GetUsing(), RTL_TEXTENCODING_UTF8 );
+
+ fwrite( strUTF8.GetBuffer(), 1, strUTF8.Len(), fp );
+ fclose( fp );
+ }
+
+ SetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), reinterpret_cast<LPCTSTR>(GetDocType().GetBuffer()) );
+ SetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szFileName );
+
+ _TCHAR szBuffer[1024];
+ TCHAR szPath[MAX_PATH];
+ LPTSTR lpFilePart;
+ PROCESS_INFORMATION ProcessInfo;
+ STARTUPINFO StartupInfo;
+
+ if ( SearchPath( NULL, TEXT("crashrep.exe"), NULL, MAX_PATH, szPath, &lpFilePart ) )
+ {
+ ZeroMemory( &StartupInfo, sizeof(StartupInfo) );
+ StartupInfo.cb = sizeof(StartupInfo.cb);
+
+ sntprintf( szBuffer, elementsof(szBuffer),
+ _T("%s -noui -load -send"),
+ szPath );
+
+ if (
+ CreateProcess(
+ NULL,
+ szBuffer,
+ NULL,
+ NULL,
+ sal_False,
+ 0,
+ NULL, NULL, &StartupInfo, &ProcessInfo )
+ )
+ {
+ DWORD dwExitCode;
+
+ WaitForSingleObject( ProcessInfo.hProcess, INFINITE );
+ if ( GetExitCodeProcess( ProcessInfo.hProcess, &dwExitCode ) && 0 == dwExitCode )
+ return true;
+
+ }
+ }
+
+ DeleteFile( szFileName );
+
+
+ return false;
+ }
+
+
+ } // namespace DocRecovery
+} // namespace svx
diff --git a/svx/source/dialog/simptabl.cxx b/svx/source/dialog/simptabl.cxx
new file mode 100644
index 000000000000..199464a0966c
--- /dev/null
+++ b/svx/source/dialog/simptabl.cxx
@@ -0,0 +1,579 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE -------------------------------------------------------------------
+
+#include <svx/simptabl.hxx>
+#include <vcl/svapp.hxx>
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+#include <unotools/intlwrapper.hxx>
+
+// SvxSimpTblContainer ------------------------------------------------------
+
+SvxSimpTblContainer::SvxSimpTblContainer( Window* pParent, WinBits nWinStyle):
+ Control(pParent,nWinStyle)
+{
+ //Do Nothing;
+}
+
+SvxSimpTblContainer::SvxSimpTblContainer( Window* pParent, const ResId& rResId):
+ Control(pParent,rResId)
+{
+ //Do Nothing;
+}
+
+long SvxSimpTblContainer::PreNotify( NotifyEvent& rNEvt )
+{
+ long nResult = sal_True;
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyCode& aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nKey = aKeyCode.GetCode();
+ if ( nKey == KEY_TAB )
+ GetParent()->Notify( rNEvt );
+ else if ( m_pTable->IsFocusOnCellEnabled() && ( nKey == KEY_LEFT || nKey == KEY_RIGHT ) )
+ return 0;
+ else
+ nResult = Control::PreNotify( rNEvt );
+ }
+ else
+ nResult = Control::PreNotify( rNEvt );
+
+ return nResult;
+}
+
+
+// SvxSimpleTable ------------------------------------------------------------
+
+SvxSimpleTable::SvxSimpleTable( Window* pParent,WinBits nBits ):
+ SvHeaderTabListBox(pParent,WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
+ aPrivContainer(pParent,nBits|WB_DIALOGCONTROL),
+ aHeaderBar(pParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ nHeaderItemId(1),
+ bResizeFlag(sal_False),
+ bPaintFlag(sal_True)
+{
+ bSortDirection=sal_True;
+ nSortCol=0xFFFF;
+ nOldPos=0;
+
+ SetParent(&aPrivContainer);
+ aHeaderBar.SetParent(&aPrivContainer);
+ aPrivContainer.SetTable( this );
+
+ aHeaderBar.SetStartDragHdl(LINK( this, SvxSimpleTable, StartDragHdl));
+ aHeaderBar.SetDragHdl(LINK( this, SvxSimpleTable, DragHdl));
+ aHeaderBar.SetEndDragHdl(LINK( this, SvxSimpleTable, EndDragHdl));
+ aHeaderBar.SetSelectHdl(LINK( this, SvxSimpleTable, HeaderBarClick));
+ aHeaderBar.SetDoubleClickHdl(LINK( this, SvxSimpleTable, HeaderBarDblClick));
+
+ EnableCellFocus();
+ DisableTransientChildren();
+ InitHeaderBar( &aHeaderBar );
+
+ aHeaderBar.Show();
+ SvHeaderTabListBox::Show();
+}
+
+
+SvxSimpleTable::SvxSimpleTable( Window* pParent,const ResId& rResId):
+ SvHeaderTabListBox(pParent,WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
+ aPrivContainer(pParent,rResId),
+ aHeaderBar(pParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+ nHeaderItemId(1),
+ bResizeFlag(sal_True),
+ bPaintFlag(sal_True)
+{
+
+ bSortDirection=sal_True;
+ nOldPos=0;
+ nSortCol=0xFFFF;
+
+ pMyParentWin=pParent;
+ SetParent(&aPrivContainer);
+ aHeaderBar.SetParent(&aPrivContainer);
+ aPrivContainer.SetTable( this );
+
+ WinBits nBits=aPrivContainer.GetStyle()|WB_DIALOGCONTROL;
+ aPrivContainer.SetStyle(nBits);
+
+ aHeaderBar.SetStartDragHdl(LINK( this, SvxSimpleTable, StartDragHdl));
+ aHeaderBar.SetDragHdl(LINK( this, SvxSimpleTable, DragHdl));
+ aHeaderBar.SetEndDragHdl(LINK( this, SvxSimpleTable, EndDragHdl));
+ aHeaderBar.SetSelectHdl(LINK( this, SvxSimpleTable, HeaderBarClick));
+ aHeaderBar.SetDoubleClickHdl(LINK( this, SvxSimpleTable, HeaderBarDblClick));
+
+ Size theWinSize=aPrivContainer.GetOutputSizePixel();
+ Size HbSize=aHeaderBar.GetSizePixel();
+
+ HbSize.Width()=theWinSize.Width();
+ theWinSize.Height()-=HbSize.Height();
+ Point thePos(0,0);
+
+ aHeaderBar.SetPosPixel(thePos);
+ aHeaderBar.SetSizePixel(HbSize);
+
+ thePos.Y()+=HbSize.Height();
+ SvHeaderTabListBox::SetPosPixel(thePos);
+ SvHeaderTabListBox::SetSizePixel(theWinSize);
+
+ EnableCellFocus();
+ DisableTransientChildren();
+ InitHeaderBar( &aHeaderBar );
+
+ aHeaderBar.Show();
+ SvHeaderTabListBox::Show();
+}
+
+SvxSimpleTable::~SvxSimpleTable()
+{
+ SetParent(pMyParentWin);
+ aPrivContainer.SetParent(this);
+ aHeaderBar.SetParent(this);
+}
+
+
+void SvxSimpleTable::UpdateViewSize()
+{
+ Size theWinSize=aPrivContainer.GetOutputSizePixel();
+ Size HbSize=aHeaderBar.GetSizePixel();
+
+ HbSize.Width()=theWinSize.Width();
+ theWinSize.Height()-=HbSize.Height();
+ Point thePos(0,0);
+
+ aHeaderBar.SetPosPixel(thePos);
+ aHeaderBar.SetSizePixel(HbSize);
+
+ thePos.Y()+=HbSize.Height();
+ SvHeaderTabListBox::SetPosPixel(thePos);
+ SvHeaderTabListBox::SetSizePixel(theWinSize);
+ Invalidate();
+}
+
+void SvxSimpleTable::NotifyScrolled()
+{
+ long nOffset=-GetXOffset();
+ if(nOldPos!=nOffset)
+ {
+ aHeaderBar.SetOffset(nOffset);
+ aHeaderBar.Invalidate();
+ aHeaderBar.Update();
+ nOldPos=nOffset;
+ }
+ SvHeaderTabListBox::NotifyScrolled();
+}
+
+void SvxSimpleTable::SetTabs()
+{
+ SvHeaderTabListBox::SetTabs();
+
+ sal_uInt16 nPrivTabCount = TabCount();
+ if ( nPrivTabCount )
+ {
+ if ( nPrivTabCount > aHeaderBar.GetItemCount() )
+ nPrivTabCount = aHeaderBar.GetItemCount();
+
+ sal_uInt16 i, nNewSize = static_cast< sal_uInt16 >( GetTab(0) ), nPos = 0;
+ for ( i = 1; i < nPrivTabCount; ++i )
+ {
+ nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
+ aHeaderBar.SetItemSize( i, nNewSize );
+ nPos = (sal_uInt16)GetTab(i);
+ }
+
+ aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
+ }
+}
+
+void SvxSimpleTable::SetTabs( long* pTabs, MapUnit eMapUnit)
+{
+ SvHeaderTabListBox::SetTabs(pTabs,eMapUnit);
+}
+
+void SvxSimpleTable::Paint( const Rectangle& rRect )
+{
+ SvHeaderTabListBox::Paint(rRect );
+
+ sal_uInt16 nPrivTabCount = TabCount();
+ sal_uInt16 nPos = 0;
+ sal_uInt16 nNewSize = ( nPrivTabCount > 0 ) ? (sal_uInt16)GetTab(0) : 0;
+
+ long nOffset=-GetXOffset();
+ nOldPos=nOffset;
+
+ aHeaderBar.SetOffset(nOffset);
+ aHeaderBar.Invalidate();
+
+ if(nPrivTabCount && bPaintFlag)
+ {
+ if(nPrivTabCount>aHeaderBar.GetItemCount())
+ nPrivTabCount=aHeaderBar.GetItemCount();
+
+ for(sal_uInt16 i=1;i<nPrivTabCount;i++)
+ {
+ nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
+ aHeaderBar.SetItemSize( i, nNewSize );
+ nPos= static_cast< sal_uInt16 >( GetTab(i) );
+ }
+ }
+ bPaintFlag=sal_True;
+}
+void SvxSimpleTable::InsertHeaderEntry(const XubString& rText,sal_uInt16 nCol,
+ HeaderBarItemBits nBits)
+{
+ xub_StrLen nEnd = rText.Search( sal_Unicode( '\t' ) );
+ if( nEnd == STRING_NOTFOUND )
+ {
+ aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
+ }
+ else
+ {
+ xub_StrLen nCount = rText.GetTokenCount( sal_Unicode( '\t' ) );
+
+ for( xub_StrLen i=0; i<nCount; i++ )
+ {
+ String aString=rText.GetToken(i, sal_Unicode( '\t' ) );
+ aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
+ }
+ }
+ SetTabs();
+}
+
+void SvxSimpleTable::ClearAll()
+{
+ aHeaderBar.Clear();
+ Clear();
+}
+void SvxSimpleTable::ClearHeader()
+{
+ aHeaderBar.Clear();
+}
+
+void SvxSimpleTable::ShowTable()
+{
+ aPrivContainer.Show();
+}
+
+void SvxSimpleTable::HideTable()
+{
+ aPrivContainer.Hide();
+}
+
+sal_Bool SvxSimpleTable::IsVisible() const
+{
+ return aPrivContainer.IsVisible();
+}
+
+void SvxSimpleTable::EnableTable()
+{
+ aPrivContainer.Enable();
+}
+
+void SvxSimpleTable::DisableTable()
+{
+ aPrivContainer.Disable();
+}
+
+sal_Bool SvxSimpleTable::IsEnabled() const
+{
+ return aPrivContainer.IsEnabled();
+}
+
+void SvxSimpleTable::TableToTop()
+{
+ aPrivContainer.ToTop();
+}
+
+void SvxSimpleTable::SetPosPixel( const Point& rNewPos )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+}
+
+Point SvxSimpleTable::GetPosPixel() const
+{
+ return aPrivContainer.GetPosPixel();
+}
+
+void SvxSimpleTable::SetPosSizePixel( const Point& rNewPos, Size& rNewSize )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+ aPrivContainer.SetSizePixel(rNewSize);
+}
+
+void SvxSimpleTable::SetPosSize( const Point& rNewPos, const Size& rNewSize )
+{
+ aPrivContainer.SetPosPixel(rNewPos);
+ SvHeaderTabListBox::SetPosSizePixel(rNewPos,rNewSize);
+}
+
+Size SvxSimpleTable::GetSizePixel() const
+{
+ return aPrivContainer.GetSizePixel();
+}
+
+Size SvxSimpleTable::GetOutputSizePixel() const
+{
+ return aPrivContainer.GetOutputSizePixel();
+}
+
+void SvxSimpleTable::SetSizePixel(const Size& rNewSize )
+{
+ aPrivContainer.SetSizePixel(rNewSize);
+ UpdateViewSize();
+}
+
+void SvxSimpleTable::SetOutputSizePixel(const Size& rNewSize )
+{
+ aPrivContainer.SetOutputSizePixel(rNewSize);
+ UpdateViewSize();
+}
+
+sal_uInt16 SvxSimpleTable::GetSelectedCol()
+{
+ return (aHeaderBar.GetCurItemId()-1);
+}
+
+void SvxSimpleTable::SortByCol(sal_uInt16 nCol,sal_Bool bDir)
+{
+ bSortDirection=bDir;
+ if(nSortCol!=0xFFFF)
+ aHeaderBar.SetItemBits(nSortCol+1,HIB_STDSTYLE);
+
+ if (nCol != 0xFFFF)
+ {
+ if(bDir)
+ {
+ aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW);
+ GetModel()->SetSortMode(SortAscending);
+ }
+ else
+ {
+ aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW);
+ GetModel()->SetSortMode(SortDescending);
+ }
+ nSortCol=nCol;
+ GetModel()->SetCompareHdl( LINK( this, SvxSimpleTable, CompareHdl));
+ GetModel()->Resort();
+ }
+ else
+ GetModel()->SetSortMode(SortNone);
+ nSortCol=nCol;
+}
+
+void SvxSimpleTable::HBarClick()
+{
+ sal_uInt16 nId=aHeaderBar.GetCurItemId();
+
+ if (aHeaderBar.GetItemBits(nId) & HIB_CLICKABLE)
+ {
+ if(nId==nSortCol+1)
+ {
+ SortByCol(nId-1,!bSortDirection);
+ }
+ else
+ {
+ SortByCol(nId-1,bSortDirection);
+ }
+
+ aHeaderBarClickLink.Call(this);
+ }
+}
+
+void SvxSimpleTable::HBarDblClick()
+{
+ aHeaderBarDblClickLink.Call(this);
+}
+
+void SvxSimpleTable::HBarStartDrag()
+{
+ if(!aHeaderBar.IsItemMode())
+ {
+ Rectangle aSizeRect(Point(0,0),
+ SvHeaderTabListBox::GetOutputSizePixel());
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+}
+void SvxSimpleTable::HBarDrag()
+{
+ HideTracking();
+ if(!aHeaderBar.IsItemMode())
+ {
+ Rectangle aSizeRect(Point(0,0),
+ SvHeaderTabListBox::GetOutputSizePixel());
+ aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
+ aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+}
+void SvxSimpleTable::HBarEndDrag()
+{
+ HideTracking();
+ sal_uInt16 nPrivTabCount=TabCount();
+ sal_uInt16 nPos=0;
+ sal_uInt16 nNewSize=0;
+
+ if(nPrivTabCount)
+ {
+ if(nPrivTabCount>aHeaderBar.GetItemCount())
+ nPrivTabCount=aHeaderBar.GetItemCount();
+
+ //for(sal_uInt16 i=1;i<=nPrivTabCount;i++)
+ for(sal_uInt16 i=1;i<nPrivTabCount;i++)
+ {
+ nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos;
+ SetTab( i, nNewSize, MAP_PIXEL );
+ nPos = nNewSize;
+ }
+ }
+ bPaintFlag=sal_False;
+ Invalidate();
+ Update();
+}
+
+CommandEvent SvxSimpleTable::GetCommandEvent() const
+{
+ return aCEvt;
+}
+
+void SvxSimpleTable::Command( const CommandEvent& rCEvt )
+{
+ aCEvt=rCEvt;
+ aCommandLink.Call(this);
+ SvHeaderTabListBox::Command(rCEvt);
+}
+
+IMPL_LINK( SvxSimpleTable, StartDragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarStartDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, DragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, EndDragHdl, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarEndDrag();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarClick();
+ }
+ return 0;
+}
+
+IMPL_LINK( SvxSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr)
+{
+ if(pCtr==&aHeaderBar)
+ {
+ HBarDblClick();
+ }
+ return 0;
+}
+
+SvLBoxItem* SvxSimpleTable::GetEntryAtPos( SvLBoxEntry* pEntry, sal_uInt16 nPos ) const
+{
+ DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry");
+ SvLBoxItem* pItem = NULL;
+
+ if( pEntry )
+ {
+ sal_uInt16 nCount = pEntry->ItemCount();
+
+ nPos++;
+
+ if( nTreeFlags & TREEFLAG_CHKBTN ) nPos++;
+
+ if( nPos < nCount )
+ {
+ pItem = pEntry->GetItem( nPos);
+ }
+ }
+ return pItem;
+}
+
+StringCompare SvxSimpleTable::ColCompare(SvLBoxEntry* pLeft,SvLBoxEntry* pRight)
+{
+ StringCompare eCompare=COMPARE_EQUAL;
+
+ SvLBoxItem* pLeftItem = GetEntryAtPos( pLeft, nSortCol);
+ SvLBoxItem* pRightItem = GetEntryAtPos( pRight, nSortCol);
+
+
+ if(pLeftItem != NULL && pRightItem != NULL)
+ {
+ sal_uInt16 nLeftKind=pLeftItem->IsA();
+ sal_uInt16 nRightKind=pRightItem->IsA();
+
+ if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
+ nLeftKind == SV_ITEM_ID_LBOXSTRING )
+ {
+ IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
+ const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator();
+
+ eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(),
+ ((SvLBoxString*)pRightItem)->GetText());
+
+ if(eCompare==COMPARE_EQUAL) eCompare=COMPARE_LESS;
+ }
+ }
+ return eCompare;
+}
+
+IMPL_LINK( SvxSimpleTable, CompareHdl, SvSortData*, pData)
+{
+ SvLBoxEntry* pLeft = (SvLBoxEntry*)(pData->pLeft );
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+ return (long) ColCompare(pLeft,pRight);
+}
+
+
diff --git a/svx/source/dialog/srchctrl.cxx b/svx/source/dialog/srchctrl.cxx
new file mode 100644
index 000000000000..fe60ac939811
--- /dev/null
+++ b/svx/source/dialog/srchctrl.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <tools/pstm.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+
+#include <svx/svxids.hrc>
+
+#define _SVX_SRCHDLG_CXX // damit private-Methoden vom SrchDlg bekannt sind
+
+
+
+#include "srchctrl.hxx"
+#include "svx/srchdlg.hxx"
+#include <svl/srchitem.hxx>
+
+// class SvxSearchFamilyControllerItem -----------------------------------
+
+SvxSearchController::SvxSearchController
+(
+ sal_uInt16 _nId,
+ SfxBindings& rBind,
+ SvxSearchDialog& rDlg
+) :
+ SfxControllerItem( _nId, rBind ),
+
+ rSrchDlg( rDlg )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE == eState )
+ {
+ if ( SID_STYLE_FAMILY1 <= nSID && nSID <= SID_STYLE_FAMILY4 )
+ {
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+
+ if ( pShell && pShell->GetStyleSheetPool() )
+ rSrchDlg.TemplatesChanged_Impl( *pShell->GetStyleSheetPool() );
+ }
+ else if ( SID_SEARCH_OPTIONS == nSID )
+ {
+ DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
+ sal_uInt16 nFlags = (sal_uInt16)( (SfxUInt16Item*)pState )->GetValue();
+ rSrchDlg.EnableControls_Impl( nFlags );
+ }
+ else if ( SID_SEARCH_ITEM == nSID )
+ {
+ DBG_ASSERT( pState->ISA(SvxSearchItem), "wrong item type" );
+ rSrchDlg.SetItem_Impl( (const SvxSearchItem*)pState );
+ }
+ }
+ else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
+ rSrchDlg.EnableControls_Impl( 0 );
+}
+
+
diff --git a/svx/source/dialog/srchctrl.hxx b/svx/source/dialog/srchctrl.hxx
new file mode 100644
index 000000000000..6320ddeb8420
--- /dev/null
+++ b/svx/source/dialog/srchctrl.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHCTRL_HXX
+#define _SVX_SRCHCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+
+#include <sfx2/ctrlitem.hxx>
+// class SvxSearchFamilyController ---------------------------------------
+
+class SvxSearchDialog;
+
+class SvxSearchController : public SfxControllerItem
+{
+ SvxSearchDialog& rSrchDlg;
+
+protected:
+ virtual void StateChanged( sal_uInt16, SfxItemState, const SfxPoolItem* pState );
+
+public:
+ SvxSearchController( sal_uInt16 nId, SfxBindings& rBnd, SvxSearchDialog& rDlg );
+};
+
+
+#endif
+
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
new file mode 100644
index 000000000000..5f91c6dabacb
--- /dev/null
+++ b/svx/source/dialog/srchdlg.cxx
@@ -0,0 +1,2549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+#include <vcl/wrkwin.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/style.hxx>
+#include <unotools/searchopt.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/cjkoptions.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svl/itempool.hxx>
+#include <svl/intitem.hxx>
+
+#include <sfx2/app.hxx>
+#include <toolkit/unohlp.hxx>
+
+#define _SVX_SRCHDLG_CXX
+#include "svx/srchdlg.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/svxitems.hrc>
+#include "srchdlg.hrc"
+
+
+#define ITEMID_SETITEM 0
+
+#include <svl/srchitem.hxx>
+#include <svx/pageitem.hxx>
+#include "srchctrl.hxx"
+#include <svx/dialmgr.hxx>
+#include "svx/dlgutil.hxx"
+#include <editeng/brshitem.hxx>
+#include <tools/resary.hxx>
+#include <svx/svxdlg.hxx> //CHINA001
+
+#include <sfx2/layout-pre.hxx>
+
+using namespace com::sun::star::i18n;
+using namespace com::sun::star;
+using namespace comphelper;
+
+// -----------------------------------------------------------------------
+
+#define REMEMBER_SIZE 10
+
+#define MODIFY_SEARCH 0x00000001
+#define MODIFY_REPLACE 0x00000002
+#define MODIFY_WORD 0x00000004
+#define MODIFY_EXACT 0x00000008
+#define MODIFY_BACKWARDS 0x00000010
+#define MODIFY_SELECTION 0x00000020
+#define MODIFY_REGEXP 0x00000040
+#define MODIFY_LAYOUT 0x00000080
+#define MODIFY_SIMILARITY 0x00000100
+#define MODIFY_FORMULAS 0x00000200
+#define MODIFY_VALUES 0x00000400
+#define MODIFY_CALC_NOTES 0x00000800
+#define MODIFY_ROWS 0x00001000
+#define MODIFY_COLUMNS 0x00002000
+#define MODIFY_ALLTABLES 0x00004000
+#define MODIFY_NOTES 0x00008000
+
+SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
+
+//#define NotifyApp( nId )
+// rBindings.ExecuteSynchron( nId, (const SfxPoolItem**)&pSearchItem, 0L )
+
+#define GetCheckBoxValue( rBox ) \
+ rBox.IsEnabled() ? rBox.IsChecked() : sal_False
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#endif /* ENABLE_LAYOUT */
+
+struct SearchDlg_Impl
+{
+ FixedText aSearchFormats;
+ FixedText aReplaceFormats;
+
+ sal_Bool bMultiLineEdit : 1,
+ bSaveToModule : 1,
+ bFocusOnSearch : 1,
+ bDeltaCalculated : 1;
+ sal_uInt16* pRanges;
+ Timer aSelectionTimer;
+
+ uno::Reference< frame::XDispatch > xCommand1Dispatch;
+ uno::Reference< frame::XDispatch > xCommand2Dispatch;
+ util::URL aCommand1URL;
+ util::URL aCommand2URL;
+
+#if ENABLE_LAYOUT
+ SearchDlg_Impl( layout::Context* pParent ) :
+#else /* !ENABLE_LAYOUT */
+ SearchDlg_Impl( Window* pParent ) :
+#endif /* !ENABLE_LAYOUT */
+ aSearchFormats ( pParent, SVX_RES( FT_SEARCH_FORMATS ) ),
+ aReplaceFormats ( pParent, SVX_RES( FT_REPLACE_FORMATS ) ),
+ bMultiLineEdit ( sal_False ),
+ bSaveToModule ( sal_True ),
+ bFocusOnSearch ( sal_True ),
+ bDeltaCalculated( sal_False ),
+ pRanges ( NULL )
+ {
+ aCommand1URL.Complete = aCommand1URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent1");
+ aCommand1URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
+ aCommand1URL.Path = rtl::OUString::createFromAscii("SearchViaComponent1");
+ aCommand2URL.Complete = aCommand2URL.Main = rtl::OUString::createFromAscii("vnd.sun.search:SearchViaComponent2");
+ aCommand2URL.Protocol = rtl::OUString::createFromAscii("vnd.sun.search:");
+ aCommand2URL.Path = rtl::OUString::createFromAscii("SearchViaComponent2");
+ }
+ ~SearchDlg_Impl() { delete[] pRanges; }
+};
+
+// -----------------------------------------------------------------------
+
+void ListToStrArr_Impl( sal_uInt16 nId, SvStringsDtor& rStrLst, ComboBox& rCBox )
+{
+ SfxStringListItem* pSrchItem =
+ (SfxStringListItem*)SFX_APP()->GetItem( nId );
+ List* pLst = pSrchItem ? pSrchItem->GetList() : 0;
+
+ if ( pLst )
+ for ( sal_uInt16 i = 0; i < pLst->Count(); ++i )
+ {
+ String* pTmp = new String( *(String*)( pLst->GetObject(i) ) );
+ rStrLst.Insert( pTmp, rStrLst.Count() );
+ rCBox.InsertEntry( *pTmp );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StrArrToList_Impl( sal_uInt16 nId, const SvStringsDtor& rStrLst )
+{
+ DBG_ASSERT( rStrLst.Count(), "vorher abpruefen!!" );
+ List aLst;
+
+ for ( sal_uInt16 i = 0; i < rStrLst.Count(); ++i )
+ aLst.Insert( rStrLst[ i ], LIST_APPEND );
+
+ SFX_APP()->PutItem( SfxStringListItem( nId, &aLst ) );
+}
+
+// class SearchAttrItemList ----------------------------------------------
+
+SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) :
+
+ SrchAttrItemList( (sal_uInt8)rList.Count() )
+
+{
+ SrchAttrItemList::Insert( &rList, 0 );
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ _pData->pItem = _pData->pItem->Clone();
+}
+
+// -----------------------------------------------------------------------
+
+SearchAttrItemList::~SearchAttrItemList()
+{
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void SearchAttrItemList::Put( const SfxItemSet& rSet )
+{
+ if ( !rSet.Count() )
+ return;
+
+ SfxItemPool* pPool = rSet.GetPool();
+ SfxItemIter aIter( rSet );
+ SearchAttrItem aItem;
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ sal_uInt16 nWhich;
+
+ while ( sal_True )
+ {
+ // nur testen, ob vorhanden ist ?
+ if( IsInvalidItem( pItem ) )
+ {
+ nWhich = rSet.GetWhichByPos( aIter.GetCurPos() );
+ aItem.pItem = (SfxPoolItem*)pItem;
+ }
+ else
+ {
+ nWhich = pItem->Which();
+ aItem.pItem = pItem->Clone();
+ }
+
+ aItem.nSlot = pPool->GetSlotId( nWhich );
+ Insert( aItem );
+
+ if ( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
+{
+ SfxItemPool* pPool = rSet.GetPool();
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( IsInvalidItem( _pData->pItem ) )
+ rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) );
+ else
+ rSet.Put( *_pData->pItem );
+ return rSet;
+}
+
+// -----------------------------------------------------------------------
+
+void SearchAttrItemList::Clear()
+{
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData();
+
+ for ( sal_uInt16 i = Count(); i; --i, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ delete _pData->pItem;
+ SrchAttrItemList::Remove( 0, Count() );
+}
+
+// -----------------------------------------------------------------------
+
+// l"oscht die Pointer auf die Items
+void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen )
+{
+ if ( nPos + nLen > Count() )
+ nLen = Count() - nPos;
+ SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos;
+
+ for ( sal_uInt16 n = nLen; n; --n, ++_pData )
+ if ( !IsInvalidItem( _pData->pItem ) )
+ delete _pData->pItem;
+
+ SrchAttrItemList::Remove( nPos, nLen );
+}
+
+#if ENABLE_LAYOUT
+#undef SfxModelessDialog
+#define SfxModelessDialog(bindings, child, parent, id) SfxDialog (parent, "find-and-replace.xml", id, bindings, child)
+#define SVX_RES_PLAIN(x) ResId (x, DIALOG_MGR ())
+#define THIS_SVX_RES(x) this, #x
+#else /* !ENABLE_LAYOUT */
+#define SVX_RES_PLAIN SVX_RES
+#define THIS_SVX_RES SVX_RES
+#endif /* !ENABLE_LAYOUT */
+
+#undef INI_LIST
+#define INI_LIST() \
+ aSearchText ( this, SVX_RES( FT_SEARCH ) ), \
+ aSearchLB ( this, SVX_RES( ED_SEARCH ) ), \
+ aSearchTmplLB ( this, SVX_RES( LB_SEARCH ) ), \
+ aSearchAttrText ( this, SVX_RES( FT_SEARCH_ATTR ) ), \
+ aReplaceText ( this, SVX_RES( FT_REPLACE ) ), \
+ aReplaceLB ( this, SVX_RES( ED_REPLACE ) ), \
+ aReplaceTmplLB ( this, SVX_RES( LB_REPLACE ) ), \
+ aReplaceAttrText( this, SVX_RES( FT_REPLACE_ATTR ) ), \
+ aSearchBtn ( this, SVX_RES( BTN_SEARCH ) ), \
+ aSearchAllBtn ( this, SVX_RES( BTN_SEARCH_ALL ) ), \
+ aSearchCmdLine ( this, SVX_RES( FL_SEARCH_COMMAND ) ), \
+ aReplaceBtn ( this, SVX_RES( BTN_REPLACE ) ), \
+ aReplaceAllBtn ( this, SVX_RES( BTN_REPLACE_ALL ) ), \
+ aSearchComponentFL( this, SVX_RES( FL_SEARCH_COMPONENT ) ), \
+ aSearchComponent1PB( this, SVX_RES( BTN_COMPONENT_1 ) ), \
+ aSearchComponent2PB( this, SVX_RES( BTN_COMPONENT_2 ) ), \
+ aMatchCaseCB ( this, SVX_RES( CB_MATCH_CASE ) ), \
+ aWordBtn ( this, SVX_RES( CB_WHOLE_WORDS ) ), \
+ aButtonsFL ( this, SVX_RES( FL_BUTTONS ) ), \
+ pMoreBtn ( new MoreButton( this, SVX_RES( BTN_MORE ) ) ), \
+ aHelpBtn ( this, SVX_RES( BTN_HELP ) ), \
+ aCloseBtn ( this, SVX_RES( BTN_CLOSE ) ), \
+ aOptionsFL ( this, SVX_RES( FL_OPTIONS ) ), \
+ aSelectionBtn ( this, SVX_RES( CB_SELECTIONS ) ), \
+ aBackwardsBtn ( this, SVX_RES( CB_BACKWARDS ) ), \
+ aRegExpBtn ( this, SVX_RES( CB_REGEXP ) ), \
+ aSimilarityBox ( this, SVX_RES( CB_SIMILARITY) ), \
+ aSimilarityBtn ( this, SVX_RES( PB_SIMILARITY) ), \
+ aLayoutBtn ( this, SVX_RES( CB_LAYOUTS ) ), \
+ aNotesBtn ( this, SVX_RES( CB_NOTES ) ), \
+ aJapMatchFullHalfWidthCB( this, SVX_RES( CB_JAP_MATCH_FULL_HALF_WIDTH ) ),\
+ aJapOptionsCB ( this, SVX_RES( CB_JAP_SOUNDS_LIKE ) ), \
+ aJapOptionsBtn ( this, SVX_RES( PB_JAP_OPTIONS ) ), \
+ aAttributeBtn ( this, SVX_RES( BTN_ATTRIBUTE ) ), \
+ aFormatBtn ( this, SVX_RES( BTN_FORMAT ) ), \
+ aNoFormatBtn ( this, SVX_RES( BTN_NOFORMAT ) ), \
+ aCalcFL ( this, SVX_RES( FL_CALC ) ), \
+ aCalcSearchInFT ( this, SVX_RES( FT_CALC_SEARCHIN ) ), \
+ aCalcSearchInLB ( this, SVX_RES( LB_CALC_SEARCHIN ) ), \
+ aCalcSearchDirFT( this, SVX_RES( FT_CALC_SEARCHDIR ) ), \
+ aRowsBtn ( this, SVX_RES( RB_CALC_ROWS ) ), \
+ aColumnsBtn ( this, SVX_RES( RB_CALC_COLUMNS ) ), \
+ aAllSheetsCB ( this, SVX_RES( CB_ALL_SHEETS ) ), \
+ rBindings ( rBind ), \
+ bWriter ( sal_False ), \
+ bSearch ( sal_True ), \
+ bFormat ( sal_False ), \
+ nOptions ( USHRT_MAX ), \
+ bSet ( sal_False ), \
+ bReadOnly ( sal_False ), \
+ bConstruct ( sal_True ), \
+ nModifyFlag ( 0 ), \
+ aCalcStr ( THIS_SVX_RES( STR_WORDCALC ) ), \
+ pImpl ( NULL ), \
+ pSearchList ( NULL ), \
+ pReplaceList ( new SearchAttrItemList ), \
+ pSearchItem ( NULL ), \
+ pSearchController ( NULL ), \
+ pOptionsController ( NULL ), \
+ pFamilyController ( NULL ), \
+ pSearchSetController ( NULL ), \
+ pReplaceSetController ( NULL ), \
+ nTransliterationFlags ( 0x00000000 )
+
+// class SvxSearchDialog -------------------------------------------------
+
+SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxBindings& rBind ) :
+
+ SfxModelessDialog( &rBind, NULL, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
+
+ INI_LIST()
+
+{
+ Construct_Impl();
+}
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialog::SvxSearchDialog( Window* pParent, SfxChildWindow* pChildWin, SfxBindings& rBind ) :
+
+ SfxModelessDialog( &rBind, pChildWin, pParent, SVX_RES( RID_SVXDLG_SEARCH ) ),
+
+ INI_LIST()
+
+{
+ Construct_Impl();
+}
+
+#undef INI_LIST
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) ResId (x, DIALOG_MGR ())
+#endif
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialog::~SvxSearchDialog()
+{
+ Hide();
+
+ rBindings.EnterRegistrations();
+ delete pSearchController;
+ delete pOptionsController;
+ delete pFamilyController;
+ delete pSearchSetController;
+ delete pReplaceSetController;
+ rBindings.LeaveRegistrations();
+
+ delete pSearchItem;
+ delete pImpl;
+ delete pSearchList;
+ delete pReplaceList;
+ delete pMoreBtn;
+}
+
+#if ENABLE_LAYOUT
+#undef Window
+#define Window layout::Window
+#endif /* ENABLE_LAYOUT */
+
+void lcl_MoveDown( Window& rWindow, sal_Int32 nOffset )
+{
+ Point aPos(rWindow.GetPosPixel());
+ aPos.Y() += nOffset;
+ rWindow.SetPosPixel(aPos);
+}
+
+void SvxSearchDialog::Construct_Impl()
+{
+#if ENABLE_LAYOUT
+ SetHelpId (".uno:SearchDialog");
+#endif /* ENABLE_LAYOUT */
+
+ // temporary to avoid incompatibility
+ pImpl = new SearchDlg_Impl( this );
+#if !ENABLE_LAYOUT
+ pImpl->aSelectionTimer.SetTimeout( 500 );
+ pImpl->aSelectionTimer.SetTimeoutHdl(
+ LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
+#endif /* !ENABLE_LAYOUT */
+ EnableControls_Impl( 0 );
+
+ // alten Text des aWordBtn's merken
+ aCalcStr += sal_Unicode('#');
+ aCalcStr += aWordBtn.GetText();
+
+ aLayoutStr = SVX_RESSTR( RID_SVXSTR_SEARCH_STYLES );
+ aStylesStr = aLayoutBtn.GetText();
+
+ // gemerkte Such-Strings von der Applikation holen
+ ListToStrArr_Impl( SID_SEARCHDLG_SEARCHSTRINGS,
+ aSearchStrings, aSearchLB );
+ ListToStrArr_Impl( SID_SEARCHDLG_REPLACESTRINGS,
+ aReplaceStrings, aReplaceLB );
+
+ pMoreBtn->SetMoreText( String( SVX_RES( STR_MORE_BTN ) ) );
+ pMoreBtn->SetLessText( String( SVX_RES( STR_LESS_BTN ) ) );
+
+ FreeResource();
+ InitControls_Impl();
+
+ // Attribut-Sets nur einmal im Ctor() besorgen
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ const SvxSetItem* pSrchSetItem =
+ (const SvxSetItem*) rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pSrchSetItem )
+ InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 );
+
+ const SvxSetItem* pReplSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pReplSetItem )
+ InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() );
+
+ // Controller erzeugen und gleich aktualisieren
+ rBindings.EnterRegistrations();
+ pSearchController =
+ new SvxSearchController( SID_SEARCH_ITEM, rBindings, *this );
+ pOptionsController =
+ new SvxSearchController( SID_SEARCH_OPTIONS, rBindings, *this );
+ rBindings.LeaveRegistrations();
+ rBindings.GetDispatcher()->Execute( FID_SEARCH_ON, SFX_CALLMODE_SLOT, ppArgs );
+ pImpl->aSelectionTimer.Start();
+
+
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsJapaneseFindEnabled())
+ {
+ aJapOptionsCB.Check( sal_False );
+ aJapOptionsCB.Hide();
+ aJapOptionsBtn.Hide();
+ }
+ if(!aCJKOptions.IsCJKFontEnabled())
+ {
+ aJapMatchFullHalfWidthCB.Hide();
+ }
+ //component extension - show component search buttons if the commands
+ // vnd.sun.star::SearchViaComponent1 and 2 are supported
+ const uno::Reference< frame::XFrame >xFrame = rBindings.GetActiveFrame();
+ const uno::Reference< frame::XDispatchProvider > xDispatchProv(xFrame, uno::UNO_QUERY);
+ rtl::OUString sTarget = rtl::OUString::createFromAscii("_self");
+
+ bool bSearchComponent1 = false;
+ bool bSearchComponent2 = false;
+ if(xDispatchProv.is() &&
+ (pImpl->xCommand1Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand1URL, sTarget, 0)).is())
+ {
+ bSearchComponent1 = true;
+ }
+ if(xDispatchProv.is() &&
+ (pImpl->xCommand2Dispatch = xDispatchProv->queryDispatch(pImpl->aCommand2URL, sTarget, 0)).is())
+ {
+ bSearchComponent2 = true;
+ }
+
+ if( bSearchComponent1 || bSearchComponent2 )
+ {
+ //get the labels of the FixedLine and the buttons
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchGroupLabel
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel1
+ // "/org.openoffice.Office.Common/SearchOptions/ComponentSearchCommandLabel2
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(xMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider"))),
+ uno::UNO_QUERY);
+ uno::Sequence< uno::Any > aArgs(1);
+ ::rtl::OUString sPath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/SearchOptions/"));
+ aArgs[0] <<= sPath;
+
+ uno::Reference< uno::XInterface > xIFace = xConfigurationProvider->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess")),
+ aArgs);
+ uno::Reference< container::XNameAccess> xDirectAccess(xIFace, uno::UNO_QUERY);
+ if(xDirectAccess.is())
+ {
+ ::rtl::OUString sTemp;
+ ::rtl::OUString sProperty(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchGroupLabel"));
+ uno::Any aRet = xDirectAccess->getByName(sProperty);
+ aRet >>= sTemp;
+ aSearchComponentFL.SetText( sTemp );
+ aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel1")));
+ aRet >>= sTemp;
+ aSearchComponent1PB.SetText( sTemp );
+ aRet = xDirectAccess->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ComponentSearchCommandLabel2")));
+ aRet >>= sTemp;
+ aSearchComponent2PB.SetText( sTemp );
+ }
+ }
+ catch(uno::Exception&){}
+
+ if(aSearchComponent1PB.GetText().Len() && bSearchComponent1 )
+ {
+ aSearchComponentFL.Show();
+ aSearchComponent1PB.Show();
+ }
+ if( aSearchComponent2PB.GetText().Len() )
+ {
+ if(!aSearchComponent1PB.IsVisible())
+ {
+ aSearchComponent2PB.SetPosPixel(aSearchComponent1PB.GetPosPixel());
+ }
+ aSearchComponentFL.Show();
+ aSearchComponent2PB.Show();
+ }
+ if( aSearchComponentFL.IsVisible() && aSearchComponent1PB.IsVisible() )
+ {
+
+ //dialog must be resized
+ Size aDlgSize(GetSizePixel());
+ sal_Int32 nOffset = aSearchCmdLine.GetPosPixel().Y() - aSearchAllBtn.GetPosPixel().Y()
+ - aButtonsFL.GetPosPixel().Y() + aSearchComponent2PB.GetPosPixel().Y();
+
+ aDlgSize.Height() += nOffset;
+ Window* aWindows[] =
+ {
+ &aOptionsFL,
+ &aSelectionBtn,
+ &aBackwardsBtn,
+ &aRegExpBtn,
+ &aSimilarityBox,
+ &aSimilarityBtn,
+ &aLayoutBtn,
+ &aNotesBtn,
+ &aJapMatchFullHalfWidthCB,
+ &aJapOptionsCB,
+ &aJapOptionsBtn,
+ &aAttributeBtn,
+ &aFormatBtn,
+ &aNoFormatBtn,
+ &aCalcFL,
+ &aCalcSearchInFT,
+ &aCalcSearchInLB,
+ &aCalcSearchDirFT,
+ &aRowsBtn,
+ &aColumnsBtn,
+ &aAllSheetsCB,
+ &aButtonsFL,
+ &aHelpBtn,
+ &aCloseBtn,
+ pMoreBtn,
+ 0
+ };
+ sal_Int32 nWindow = 0;
+ do
+ {
+ lcl_MoveDown( *aWindows[nWindow], nOffset );
+ }
+ while(aWindows[++nWindow]);
+
+ SetSizePixel(aDlgSize);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SvxSearchDialog::Close()
+{
+ // remember strings speichern
+ if ( aSearchStrings.Count() )
+ StrArrToList_Impl( SID_SEARCHDLG_SEARCHSTRINGS, aSearchStrings );
+
+ if ( aReplaceStrings.Count() )
+ StrArrToList_Impl( SID_SEARCHDLG_REPLACESTRINGS, aReplaceStrings );
+
+ // save settings to configuration
+ SvtSearchOptions aOpt;
+ aOpt.SetWholeWordsOnly ( aWordBtn .IsChecked() );
+ aOpt.SetBackwards ( aBackwardsBtn .IsChecked() );
+ aOpt.SetUseRegularExpression ( aRegExpBtn .IsChecked() );
+ //aOpt.SetMatchCase ( aMatchCaseCB .IsChecked() );
+ aOpt.SetSearchForStyles ( aLayoutBtn .IsChecked() );
+ aOpt.SetSimilaritySearch ( aSimilarityBox .IsChecked() );
+ //aOpt.SetMatchFullHalfWidthForms ( !aJapMatchFullHalfWidthCB.IsChecked() );
+ aOpt.SetUseAsianOptions ( aJapOptionsCB .IsChecked() );
+ aOpt.SetNotes ( aNotesBtn .IsChecked() );
+
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.GetDispatcher()->Execute( FID_SEARCH_OFF, SFX_CALLMODE_SLOT, ppArgs );
+ rBindings.Execute( SID_SEARCH_DLG );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int32 SvxSearchDialog::GetTransliterationFlags() const
+{
+ if (!aMatchCaseCB.IsChecked())
+ nTransliterationFlags |= TransliterationModules_IGNORE_CASE;
+ else
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_CASE;
+ if ( !aJapMatchFullHalfWidthCB.IsChecked())
+ nTransliterationFlags |= TransliterationModules_IGNORE_WIDTH;
+ else
+ nTransliterationFlags &= ~TransliterationModules_IGNORE_WIDTH;
+ return nTransliterationFlags;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::ApplyTransliterationFlags_Impl( sal_Int32 nSettings )
+{
+ nTransliterationFlags = nSettings;
+ sal_Bool bVal = 0 != (nSettings & TransliterationModules_IGNORE_CASE);
+ aMatchCaseCB .Check(!bVal );
+ bVal = 0 != (nSettings & TransliterationModules_IGNORE_WIDTH);
+ aJapMatchFullHalfWidthCB.Check( !bVal );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Activate()
+{
+ // apply possible transliteration changes of the SvxSearchItem member
+ DBG_ASSERT( pSearchItem, "SearchItem missing" );
+ if (pSearchItem)
+ {
+ aMatchCaseCB .Check( pSearchItem->GetExact() );
+ aJapMatchFullHalfWidthCB.Check( !pSearchItem->IsMatchFullHalfWidthForms() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::InitControls_Impl()
+{
+ // CaseSensitives AutoComplete
+ aSearchLB.EnableAutocomplete( sal_True, sal_True );
+ aSearchLB.Show();
+ aReplaceLB.EnableAutocomplete( sal_True, sal_True );
+ aReplaceLB.Show();
+
+ aFormatBtn.Disable();
+ aAttributeBtn.Disable();
+
+ aSearchLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) );
+ aReplaceLB.SetModifyHdl( LINK( this, SvxSearchDialog, ModifyHdl_Impl ) );
+
+ Link aLink = LINK( this, SvxSearchDialog, FocusHdl_Impl );
+ aSearchLB.SetGetFocusHdl( aLink );
+ pImpl->aSearchFormats.SetGetFocusHdl( aLink );
+
+ aReplaceLB.SetGetFocusHdl( aLink );
+ pImpl->aReplaceFormats.SetGetFocusHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, LoseFocusHdl_Impl );
+ aSearchLB.SetLoseFocusHdl( aLink );
+ aReplaceLB.SetLoseFocusHdl( aLink );
+
+ aSearchTmplLB.SetLoseFocusHdl( aLink );
+ aReplaceTmplLB.SetLoseFocusHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, CommandHdl_Impl );
+ aSearchBtn.SetClickHdl( aLink );
+ aSearchAllBtn.SetClickHdl( aLink );
+ aReplaceBtn.SetClickHdl( aLink );
+ aReplaceAllBtn.SetClickHdl( aLink );
+ aCloseBtn.SetClickHdl( aLink );
+ aSimilarityBtn.SetClickHdl( aLink );
+ aJapOptionsBtn.SetClickHdl( aLink );
+ aSearchComponent1PB.SetClickHdl( aLink );
+ aSearchComponent2PB.SetClickHdl( aLink );
+
+ aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+ aWordBtn.SetClickHdl( aLink );
+ aSelectionBtn.SetClickHdl( aLink );
+ aMatchCaseCB.SetClickHdl( aLink );
+ aRegExpBtn.SetClickHdl( aLink );
+ aBackwardsBtn.SetClickHdl( aLink );
+ aNotesBtn.SetClickHdl( aLink );
+ aSimilarityBox.SetClickHdl( aLink );
+ aJapOptionsCB.SetClickHdl( aLink );
+ aJapMatchFullHalfWidthCB.SetClickHdl( aLink );
+
+ aLayoutBtn.SetClickHdl( LINK( this, SvxSearchDialog, TemplateHdl_Impl ) );
+ aFormatBtn.SetClickHdl( LINK( this, SvxSearchDialog, FormatHdl_Impl ) );
+ aNoFormatBtn.SetClickHdl(
+ LINK( this, SvxSearchDialog, NoFormatHdl_Impl ) );
+ aAttributeBtn.SetClickHdl(
+ LINK( this, SvxSearchDialog, AttributeHdl_Impl ) );
+
+ // check if buttontext is to wide
+ long nTxtW = Max( pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetMoreText() ),
+ pMoreBtn->GetCtrlTextWidth( pMoreBtn->GetLessText() ) );
+ nTxtW += ( pMoreBtn->GetTextHeight() * 2 ); // add image size + offset
+ long nBtnW = pMoreBtn->GetSizePixel().Width();
+ if ( nTxtW > nBtnW )
+ {
+ // broaden the button
+ const long nMinDelta = 10;
+ long nDelta = Max( nTxtW - nBtnW, nMinDelta );
+ Size aNewSize = pMoreBtn->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ pMoreBtn->SetSizePixel( aNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::CalculateDelta_Impl()
+{
+ DBG_ASSERT( pSearchItem, "no search item" );
+
+ bool bDrawApp = false;
+ bool bCalcApp = false;
+ bool bWriterApp = false;
+ bool bImpressApp = false;
+ const uno::Reference< frame::XFrame > xFrame = rBindings.GetActiveFrame();
+ uno::Reference< frame::XModuleManager > xModuleManager(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), uno::UNO_QUERY );
+ if ( xModuleManager.is() )
+ {
+ try
+ {
+ ::rtl::OUString aModuleIdentifier = xModuleManager->identify( xFrame );
+ bCalcApp = aModuleIdentifier.equalsAscii( "com.sun.star.sheet.SpreadsheetDocument" );
+ bDrawApp = aModuleIdentifier.equalsAscii( "com.sun.star.drawing.DrawingDocument" );
+ bImpressApp = aModuleIdentifier.equalsAscii( "com.sun.star.presentation.PresentationDocument" );
+ bWriterApp = aModuleIdentifier.equalsAscii( "com.sun.star.text.TextDocument" );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ if ( pImpl->bDeltaCalculated )
+ return;
+ else
+ pImpl->bDeltaCalculated = sal_True;
+
+ sal_uIntPtr nDelta = 187, nOffset = 0;
+ SvtCJKOptions aCJKOptions;
+
+ pMoreBtn->AddWindow( &aOptionsFL );
+ if ( !bDrawApp )
+ pMoreBtn->AddWindow( &aLayoutBtn );
+ if ( bWriterApp )
+ pMoreBtn->AddWindow( &aNotesBtn );
+ else
+ {
+ aNotesBtn.Hide();
+ nOffset = !bDrawApp ? 13 : 0;
+ }
+ pMoreBtn->AddWindow( &aBackwardsBtn );
+ if ( !bDrawApp )
+ pMoreBtn->AddWindow( &aRegExpBtn );
+ pMoreBtn->AddWindow( &aSimilarityBox );
+ pMoreBtn->AddWindow( &aSimilarityBtn );
+ pMoreBtn->AddWindow( &aSelectionBtn );
+
+ if ( aCJKOptions.IsCJKFontEnabled() )
+ pMoreBtn->AddWindow( &aJapMatchFullHalfWidthCB );
+ else
+ nOffset += 13;
+ if ( aCJKOptions.IsJapaneseFindEnabled() )
+ {
+ pMoreBtn->AddWindow( &aJapOptionsCB );
+ pMoreBtn->AddWindow( &aJapOptionsBtn );
+ }
+ else
+ nOffset += 17;
+
+ if ( bWriter )
+ {
+ pMoreBtn->AddWindow( &aAttributeBtn );
+ pMoreBtn->AddWindow( &aFormatBtn );
+ pMoreBtn->AddWindow( &aNoFormatBtn );
+ }
+
+ if (bDrawApp || bImpressApp)
+ {
+ // "Find All" button is hidden--align "Find" vertically to the
+ // search listbox
+ Point aNewPt(aSearchBtn.GetPosPixel());
+ const Size aBtnSz(aSearchBtn.GetSizePixel());
+ const Size aLBSz(aSearchLB.GetSizePixel());
+ const int nOff((aLBSz.Height() - aBtnSz.Height()) / 2);
+ aNewPt.Y() = aSearchLB.GetPosPixel().Y() + nOff;
+ aSearchBtn.SetPosPixel(aNewPt);
+ }
+
+ if ( bDrawApp )
+ {
+ // Draw App: "Regular expressions" and "Search for Styles" check boxes are hidden
+ // so align the other buttons
+ const long nAppFontHeight = 13; // checkbox height + space between in APPFONT
+ long nH = LogicToPixel( Size( 0, nAppFontHeight ), MAP_APPFONT ).Height();
+
+ Point aNewPos = aSimilarityBox.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aSimilarityBox.SetPosPixel( aNewPos );
+ aNewPos = aSimilarityBtn.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aSimilarityBtn.SetPosPixel( aNewPos );
+ nH *= 3;
+ nOffset += ( 3 * nAppFontHeight );
+ if ( aCJKOptions.IsCJKFontEnabled() )
+ {
+ aNewPos = aJapMatchFullHalfWidthCB.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapMatchFullHalfWidthCB.SetPosPixel( aNewPos );
+ }
+ if ( aCJKOptions.IsJapaneseFindEnabled() )
+ {
+ aNewPos = aJapOptionsCB.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapOptionsCB.SetPosPixel( aNewPos );
+ aNewPos = aJapOptionsBtn.GetPosPixel();
+ aNewPos.Y() -= nH;
+ aJapOptionsBtn.SetPosPixel( aNewPos );
+ }
+ }
+
+ if ( bCalcApp || bImpressApp )
+ {
+ Window* pWins[] =
+ {
+ &aCalcFL, &aCalcSearchInFT, &aCalcSearchInLB, &aCalcSearchDirFT,
+ &aRowsBtn, &aColumnsBtn, &aAllSheetsCB, &aJapMatchFullHalfWidthCB,
+ &aJapOptionsCB, &aJapOptionsBtn
+ };
+ Window** pCurrent = pWins;
+ sal_uInt32 i = 0;
+ const sal_uInt32 nCalcCtrlCount = 7;
+ if ( nOffset > 0 )
+ {
+ long nH = LogicToPixel( Size( 0, nOffset ), MAP_APPFONT ).Height();
+ for ( i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
+ {
+ if ( ( bCalcApp && i < nCalcCtrlCount )
+ || ( i == nCalcCtrlCount && aCJKOptions.IsCJKFontEnabled() )
+ || ( i > nCalcCtrlCount && aCJKOptions.IsJapaneseFindEnabled() ) )
+ {
+ Point aNewPos = (*pCurrent)->GetPosPixel();
+ aNewPos.Y() -= nH;
+ (*pCurrent)->SetPosPixel( aNewPos );
+ }
+ }
+ }
+
+ if ( bCalcApp)
+ {
+ pCurrent = pWins;
+ for ( i = 0; i < nCalcCtrlCount; ++i, ++pCurrent )
+ pMoreBtn->AddWindow( *pCurrent );
+ }
+ else
+ nOffset += 64;
+ }
+ else
+ nOffset += 64;
+
+ pMoreBtn->SetDelta( nDelta - nOffset );
+ pMoreBtn->Show();
+ pMoreBtn->Enable();
+}
+
+#if ENABLE_LAYOUT
+#undef Window
+#define Window ::Window
+#endif /* ENABLE_LAYOUT */
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Init_Impl( int bSearchPattern )
+{
+ DBG_ASSERT( pSearchItem, "SearchItem == 0" );
+ bWriter = ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_WRITER );
+
+ pImpl->bMultiLineEdit = sal_False;
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ pImpl->aSearchFormats.Hide();
+ aSearchAttrText.Show();
+ pImpl->aReplaceFormats.Hide();
+ aReplaceAttrText.Show();
+ }
+ else
+ {
+ String aText = aSearchAttrText.GetText();
+ aSearchAttrText.Hide();
+
+ if ( aText.Len() )
+ pImpl->aSearchFormats.SetText( aText );
+ pImpl->aSearchFormats.Show();
+ aText = aReplaceAttrText.GetText();
+ aReplaceAttrText.Hide();
+
+ if ( aText.Len() )
+ pImpl->aReplaceFormats.SetText( aText );
+ pImpl->aReplaceFormats.Show();
+ }
+
+ if ( ( nModifyFlag & MODIFY_WORD ) == 0 )
+ aWordBtn.Check( pSearchItem->GetWordOnly() );
+ if ( ( nModifyFlag & MODIFY_EXACT ) == 0 )
+ aMatchCaseCB.Check( pSearchItem->GetExact() );
+ if ( ( nModifyFlag & MODIFY_BACKWARDS ) == 0 )
+ aBackwardsBtn.Check( pSearchItem->GetBackward() );
+ if ( ( nModifyFlag & MODIFY_NOTES ) == 0 )
+ aNotesBtn.Check( pSearchItem->GetNotes() );
+ if ( ( nModifyFlag & MODIFY_SELECTION ) == 0 )
+ aSelectionBtn.Check( pSearchItem->GetSelection() );
+ if ( ( nModifyFlag & MODIFY_REGEXP ) == 0 )
+ aRegExpBtn.Check( pSearchItem->GetRegExp() );
+ if ( ( nModifyFlag & MODIFY_LAYOUT ) == 0 )
+ aLayoutBtn.Check( pSearchItem->GetPattern() );
+ if (aNotesBtn.IsChecked())
+ aLayoutBtn.Disable();
+ aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
+ if( aJapOptionsCB.IsVisible() )
+ aJapOptionsCB.Check( pSearchItem->IsUseAsianOptions() );
+ ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() );
+
+ CalculateDelta_Impl();
+
+ bool bDraw = sal_False;
+ if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC )
+ {
+ Link aLink = LINK( this, SvxSearchDialog, FlagHdl_Impl );
+ aCalcSearchInLB.SetSelectHdl( aLink );
+ aRowsBtn.SetClickHdl( aLink );
+ aColumnsBtn.SetClickHdl( aLink );
+ aAllSheetsCB.SetClickHdl( aLink );
+
+ switch ( pSearchItem->GetCellType() )
+ {
+ case SVX_SEARCHIN_FORMULA:
+ if ( ( nModifyFlag & MODIFY_FORMULAS ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_FORMULA );
+ break;
+
+ case SVX_SEARCHIN_VALUE:
+ if ( ( nModifyFlag & MODIFY_VALUES ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_VALUE );
+ break;
+
+ case SVX_SEARCHIN_NOTE:
+ if ( ( nModifyFlag & MODIFY_CALC_NOTES ) == 0 )
+ aCalcSearchInLB.SelectEntryPos( SVX_SEARCHIN_NOTE );
+ break;
+ }
+ aWordBtn.SetText( aCalcStr.GetToken( 0, '#' ) );
+
+ if ( pSearchItem->GetRowDirection() &&
+ ( nModifyFlag & MODIFY_ROWS ) == 0 )
+ aRowsBtn.Check();
+ else if ( !pSearchItem->GetRowDirection() &&
+ ( nModifyFlag & MODIFY_COLUMNS ) == 0 )
+ aColumnsBtn.Check();
+
+ if ( ( nModifyFlag & MODIFY_ALLTABLES ) == 0 )
+ aAllSheetsCB.Check( pSearchItem->IsAllTables() );
+
+ // nur im Writer Suche nach Formatierung
+ aFormatBtn.Hide();
+ aNoFormatBtn.Hide();
+ aAttributeBtn.Hide();
+ }
+ else
+ {
+ aWordBtn.SetText( aCalcStr.GetToken( 1, '#' ) );
+
+ if ( pSearchItem->GetAppFlag() == SVX_SEARCHAPP_DRAW )
+ {
+ aSearchAllBtn.Hide();
+
+ aRegExpBtn.Hide();
+ aLayoutBtn.Hide();
+
+ // nur im Writer Suche nach Formatierung
+ aFormatBtn.Hide();
+ aNoFormatBtn.Hide();
+ aAttributeBtn.Hide();
+ bDraw = sal_True;
+ }
+ else
+ {
+ if ( !pSearchList )
+ {
+ // Attribut-Sets besorgen, wenn noch nicht geschehen
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ const SvxSetItem* pSrchSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_SEARCHSET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pSrchSetItem )
+ InitAttrList_Impl( &pSrchSetItem->GetItemSet(), 0 );
+
+ const SvxSetItem* pReplSetItem =
+ (const SvxSetItem*)rBindings.GetDispatcher()->Execute( FID_SEARCH_REPLACESET, SFX_CALLMODE_SLOT, ppArgs );
+
+ if ( pReplSetItem )
+ InitAttrList_Impl( 0, &pReplSetItem->GetItemSet() );
+ }
+/*
+ aFormatBtn.Show();
+ aNoFormatBtn.Show();
+ aAttributeBtn.Show();
+*/
+ }
+// pMoreBtn->SetState( sal_False );
+// pMoreBtn->Hide();
+ }
+
+ if ( 0 && !bDraw ) //!!!!!
+ {
+ aRegExpBtn.Show();
+ aLayoutBtn.Show();
+ }
+
+ // "Ahnlichkeitssuche?
+ if ( ( nModifyFlag & MODIFY_SIMILARITY ) == 0 )
+ aSimilarityBox.Check( pSearchItem->IsLevenshtein() );
+ bSet = sal_True;
+
+ pImpl->bSaveToModule = sal_False;
+ FlagHdl_Impl( &aSimilarityBox );
+ FlagHdl_Impl( &aJapOptionsCB );
+ pImpl->bSaveToModule = sal_True;
+
+ bool bDisableSearch = sal_False;
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ if ( pViewShell )
+ {
+ sal_Bool bText = !bSearchPattern;
+
+ if ( pViewShell->HasSelection( bText ) )
+ EnableControl_Impl( &aSelectionBtn );
+ else
+ {
+ aSelectionBtn.Check( sal_False );
+ aSelectionBtn.Disable();
+ }
+ }
+
+ // Patternsuche und es wurden keine AttrSets "ubergeben
+ if ( bSearchPattern )
+ {
+ SfxObjectShell* pShell = SfxObjectShell::Current();
+
+ if ( pShell && pShell->GetStyleSheetPool() )
+ {
+ // Vorlagen beschaffen
+ aSearchTmplLB .Clear();
+ aReplaceTmplLB.Clear();
+ SfxStyleSheetBasePool* pStylePool = pShell->GetStyleSheetPool();
+ pStylePool->SetSearchMask( pSearchItem->GetFamily(),
+ SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pStylePool->First();
+
+ while ( pBase )
+ {
+ if ( pBase->IsUsed() )
+ aSearchTmplLB.InsertEntry( pBase->GetName() );
+ aReplaceTmplLB.InsertEntry( pBase->GetName() );
+ pBase = pStylePool->Next();
+ }
+ aSearchTmplLB.SelectEntry( pSearchItem->GetSearchString() );
+ aReplaceTmplLB.SelectEntry( pSearchItem->GetReplaceString() );
+
+ }
+ aSearchTmplLB.Show();
+
+ if ( bConstruct )
+ // nur nach dem Erzeugen den Fokus grappen
+ aSearchTmplLB.GrabFocus();
+ aReplaceTmplLB.Show();
+ aSearchLB.Hide();
+ aReplaceLB.Hide();
+
+ aWordBtn.Disable();
+ aRegExpBtn.Disable();
+ aMatchCaseCB.Disable();
+
+ bDisableSearch = !aSearchTmplLB.GetEntryCount();
+ }
+ else
+ {
+ bool bSetSearch = ( ( nModifyFlag & MODIFY_SEARCH ) == 0 );
+ bool bSetReplace = ( ( nModifyFlag & MODIFY_REPLACE ) == 0 );
+
+ if ( pSearchItem->GetSearchString().Len() && bSetSearch )
+ aSearchLB.SetText( pSearchItem->GetSearchString() );
+ else if ( aSearchStrings.Count() )
+ {
+ bool bAttributes =
+ ( ( pSearchList && pSearchList->Count() ) ||
+ ( pReplaceList && pReplaceList->Count() ) );
+
+ if ( bSetSearch && !bAttributes )
+ aSearchLB.SetText( *aSearchStrings[ 0 ] );
+
+ String aReplaceTxt = pSearchItem->GetReplaceString();
+
+ if ( aReplaceStrings.Count() )
+ aReplaceTxt = *aReplaceStrings[ 0 ];
+
+ if ( bSetReplace && !bAttributes )
+ aReplaceLB.SetText( aReplaceTxt );
+ }
+ aSearchLB.Show();
+
+ if ( bConstruct )
+ // nur nach dem Erzeugen den Fokus grappen
+ aSearchLB.GrabFocus();
+ aReplaceLB.Show();
+ aSearchTmplLB.Hide();
+ aReplaceTmplLB.Hide();
+
+ EnableControl_Impl( &aRegExpBtn );
+ EnableControl_Impl( &aMatchCaseCB );
+
+ if ( aRegExpBtn.IsChecked() )
+ aWordBtn.Disable();
+ else
+ EnableControl_Impl( &aWordBtn );
+
+ String aSrchAttrTxt;
+
+ if ( pImpl->bMultiLineEdit )
+ aSrchAttrTxt = pImpl->aSearchFormats.GetText();
+ else
+ aSrchAttrTxt = aSearchAttrText.GetText();
+
+ bDisableSearch = !aSearchLB.GetText().Len() && !aSrchAttrTxt.Len();
+ }
+ FocusHdl_Impl( &aSearchLB );
+
+ if ( bDisableSearch )
+ {
+ aSearchBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceBtn.Disable();
+ aReplaceAllBtn.Disable();
+ aSearchComponentFL.Enable(sal_False);
+ aSearchComponent1PB.Enable(sal_False);
+ aSearchComponent2PB.Enable(sal_False);
+ }
+ else
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ if (!bWriter || (bWriter && !aNotesBtn.IsChecked()))
+ {
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ if (bWriter && pSearchItem->GetNotes())
+ {
+ aSearchAllBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ }
+
+ if ( ( !pImpl->bMultiLineEdit && aSearchAttrText.GetText().Len() ) ||
+ ( pImpl->bMultiLineEdit && pImpl->aSearchFormats.GetText().Len() ) )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+
+ if ( !pSearchList )
+ {
+ aAttributeBtn.Disable();
+ aFormatBtn.Disable();
+ }
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ pImpl->bSaveToModule = sal_False;
+ TemplateHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::InitAttrList_Impl( const SfxItemSet* pSSet,
+ const SfxItemSet* pRSet )
+{
+ if ( !pSSet && !pRSet )
+ return;
+
+ if ( !pImpl->pRanges && pSSet )
+ {
+ sal_sSize nCnt = 0;
+ const sal_uInt16* pPtr = pSSet->GetRanges();
+ const sal_uInt16* pTmp = pPtr;
+
+ while( *pPtr )
+ {
+ nCnt += ( *(pPtr+1) - *pPtr ) + 1;
+ pPtr += 2;
+ }
+ nCnt = pPtr - pTmp + 1;
+ pImpl->pRanges = new sal_uInt16[nCnt];
+ memcpy( pImpl->pRanges, pTmp, sizeof(sal_uInt16) * nCnt );
+ }
+
+ // sorge daf"ur, das die Texte der Attribute richtig stehen
+ String aDesc;
+
+ if ( pSSet )
+ {
+ delete pSearchList;
+ pSearchList = new SearchAttrItemList;
+
+ if ( pSSet->Count() )
+ {
+ pSearchList->Put( *pSSet );
+
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( BuildAttrText_Impl( aDesc, sal_True ) );
+ else
+ pImpl->aSearchFormats.SetText( BuildAttrText_Impl( aDesc, sal_True ) );
+
+ if ( aDesc.Len() )
+ bFormat |= sal_True;
+ }
+ }
+
+ if ( pRSet )
+ {
+ delete pReplaceList;
+ pReplaceList = new SearchAttrItemList;
+
+ if ( pRSet->Count() )
+ {
+ pReplaceList->Put( *pRSet );
+
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( BuildAttrText_Impl( aDesc, sal_False ) );
+ else
+ pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( aDesc, sal_False ) );
+
+ if ( aDesc.Len() )
+ bFormat |= sal_True;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FlagHdl_Impl, Control *, pCtrl )
+{
+ if ( pCtrl && !bSet )
+ SetModifyFlag_Impl( pCtrl );
+ else
+ bSet = sal_False;
+
+ if ( pCtrl == &aSimilarityBox )
+ {
+ sal_Bool bIsChecked = aSimilarityBox.IsChecked();
+
+ if ( bIsChecked )
+ {
+ aSimilarityBtn.Enable();
+ aRegExpBtn.Check( sal_False );
+ aRegExpBtn.Disable();
+ EnableControl_Impl( &aWordBtn );
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ EnableControl_Impl( &aMatchCaseCB );
+ aLayoutBtn.Check( sal_False );
+ }
+ aRegExpBtn.Disable();
+ aLayoutBtn.Disable();
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aRegExpBtn );
+ if (!aNotesBtn.IsChecked())
+ EnableControl_Impl( &aLayoutBtn );
+ EnableControl_Impl( &aFormatBtn );
+ EnableControl_Impl( &aAttributeBtn );
+ aSimilarityBtn.Disable();
+ }
+ pSearchItem->SetLevenshtein( bIsChecked );
+ }
+ else
+ if ( pCtrl == &aNotesBtn)
+ {
+ if (aNotesBtn.IsChecked())
+ {
+ aLayoutBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aLayoutBtn );
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+ else
+ {
+ if ( aLayoutBtn.IsChecked() && !bFormat )
+ {
+ aWordBtn.Check( sal_False );
+ aWordBtn.Disable();
+ aRegExpBtn.Check( sal_False );
+ aRegExpBtn.Disable();
+ aMatchCaseCB.Check( sal_False );
+ aMatchCaseCB.Disable();
+ aNotesBtn.Disable();
+
+ if ( aSearchTmplLB.GetEntryCount() )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ }
+ else
+ {
+ EnableControl_Impl( &aRegExpBtn );
+ EnableControl_Impl( &aMatchCaseCB );
+ EnableControl_Impl( &aNotesBtn );
+
+ if ( aRegExpBtn.IsChecked() )
+ {
+ aWordBtn.Check( sal_False );
+ aWordBtn.Disable();
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+ else
+ {
+ EnableControl_Impl( &aWordBtn );
+ EnableControl_Impl( &aSimilarityBox );
+ }
+
+ // Such-String vorhanden? dann Buttons enablen
+ bSet = sal_True;
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+
+ if ( &aAllSheetsCB == pCtrl )
+ {
+ if ( aAllSheetsCB.IsChecked() )
+ aSearchAllBtn.Disable();
+ else
+ {
+ bSet = sal_True;
+ ModifyHdl_Impl( &aSearchLB );
+ }
+ }
+
+ if ( &aJapOptionsCB == pCtrl )
+ {
+ sal_Bool bEnableJapOpt = aJapOptionsCB.IsChecked();
+ aMatchCaseCB .Enable(!bEnableJapOpt );
+ aJapMatchFullHalfWidthCB.Enable(!bEnableJapOpt );
+ aJapOptionsBtn .Enable( bEnableJapOpt );
+ }
+
+ if ( pImpl->bSaveToModule )
+ SaveToModule_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
+{
+ bool bInclusive = ( aLayoutBtn.GetText() == aLayoutStr );
+
+ if ( ( pBtn == &aSearchBtn ) ||
+ ( pBtn == &aSearchAllBtn ) ||
+ ( pBtn == &aReplaceBtn ) ||
+ ( pBtn == &aReplaceAllBtn ) )
+ {
+ if ( aLayoutBtn.IsChecked() && !bInclusive )
+ {
+ pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() );
+ pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() );
+ }
+ else
+ {
+ pSearchItem->SetSearchString ( aSearchLB.GetText() );
+ pSearchItem->SetReplaceString( aReplaceLB.GetText() );
+
+ if ( pBtn == &aReplaceBtn )
+ Remember_Impl( aReplaceLB.GetText(), sal_False );
+ else
+ {
+ Remember_Impl( aSearchLB.GetText(), sal_True );
+
+ if ( pBtn == &aReplaceAllBtn )
+ Remember_Impl( aReplaceLB.GetText(), sal_False );
+ }
+ }
+
+ pSearchItem->SetRegExp( sal_False );
+ pSearchItem->SetLevenshtein( sal_False );
+ if (GetCheckBoxValue( aRegExpBtn ))
+ pSearchItem->SetRegExp( sal_True );
+ else if (GetCheckBoxValue( aSimilarityBox ))
+ pSearchItem->SetLevenshtein( sal_True );
+
+ pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) );
+ pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) );
+ pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) );
+ pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) );
+ pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) );
+
+ pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) );
+ sal_Int32 nFlags = GetTransliterationFlags();
+ if( !pSearchItem->IsUseAsianOptions())
+ nFlags &= (TransliterationModules_IGNORE_CASE |
+ TransliterationModules_IGNORE_WIDTH );
+ pSearchItem->SetTransliterationFlags( nFlags );
+
+ if ( !bWriter )
+ {
+ if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() );
+
+ pSearchItem->SetRowDirection( aRowsBtn.IsChecked() );
+ pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() );
+ }
+
+ if ( pBtn == &aSearchBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ else if ( pBtn == &aSearchAllBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
+ else if ( pBtn == &aReplaceBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE );
+ else if ( pBtn == &aReplaceAllBtn )
+ pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
+
+ // wenn nach Vorlagen gesucht wird, dann Format-Listen l"oschen
+ if ( !bFormat && pSearchItem->GetPattern() )
+ {
+ if ( pSearchList )
+ pSearchList->Clear();
+
+ if ( pReplaceList )
+ pReplaceList->Clear();
+ }
+ nModifyFlag = 0;
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.ExecuteSynchron( FID_SEARCH_NOW, ppArgs, 0L );
+ }
+ else if ( pBtn == &aCloseBtn )
+ {
+ if ( !aLayoutBtn.IsChecked() || bInclusive )
+ {
+ String aStr( aSearchLB.GetText() );
+
+ if ( aStr.Len() )
+ Remember_Impl( aStr, sal_True );
+ aStr = aReplaceLB.GetText();
+
+ if ( aStr.Len() )
+ Remember_Impl( aStr, sal_False );
+ }
+ SaveToModule_Impl();
+ Close();
+ }
+ else if ( pBtn == &aSimilarityBtn )
+ {
+//CHINA001 SvxSearchSimilarityDialog* pDlg =
+//CHINA001 new SvxSearchSimilarityDialog( this,
+//CHINA001 pSearchItem->IsLEVRelaxed(),
+//CHINA001 pSearchItem->GetLEVOther(),
+//CHINA001 pSearchItem->GetLEVShorter(),
+//CHINA001 pSearchItem->GetLEVLonger() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxSearchSimilarityDialog* pDlg = pFact->CreateSvxSearchSimilarityDialog( LAYOUT_THIS_WINDOW (this),
+ pSearchItem->IsLEVRelaxed(),
+ pSearchItem->GetLEVOther(),
+ pSearchItem->GetLEVShorter(),
+ pSearchItem->GetLEVLonger() );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ if ( pDlg && pDlg->Execute() == RET_OK )
+ {
+ pSearchItem->SetLEVRelaxed( pDlg->IsRelaxed() );
+ pSearchItem->SetLEVOther( pDlg->GetOther() );
+ pSearchItem->SetLEVShorter( pDlg->GetShorter() );
+ pSearchItem->SetLEVLonger( pDlg->GetLonger() );
+ SaveToModule_Impl();
+ }
+ delete pDlg;
+ }
+ }
+ else if ( pBtn == &aJapOptionsBtn )
+ {
+ SfxItemSet aSet( SFX_APP()->GetPool() );
+ pSearchItem->SetTransliterationFlags( GetTransliterationFlags() );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxJSearchOptionsDialog* aDlg = pFact->CreateSvxJSearchOptionsDialog( LAYOUT_THIS_WINDOW (this), aSet,
+ pSearchItem->GetTransliterationFlags() );
+ DBG_ASSERT(aDlg, "Dialogdiet fail!");//CHINA001
+ int nRet = aDlg->Execute(); //CHINA001 int nRet = aDlg.Execute();
+ if (RET_OK == nRet) //! true only if FillItemSet of SvxJSearchOptionsPage returns true
+ {
+ sal_Int32 nFlags = aDlg->GetTransliterationFlags(); //CHINA001 sal_Int32 nFlags = aDlg.GetTransliterationFlags();
+ pSearchItem->SetTransliterationFlags( nFlags );
+ ApplyTransliterationFlags_Impl( nFlags );
+ }
+ delete aDlg; //add for CHINA001
+ }
+ }
+ else if(pBtn == &aSearchComponent1PB || pBtn == &aSearchComponent2PB )
+ {
+ uno::Sequence < beans::PropertyValue > aArgs(2);
+ beans::PropertyValue* pArgs = aArgs.getArray();
+ pArgs[0].Name = ::rtl::OUString::createFromAscii("SearchString");
+ pArgs[0].Value <<= ::rtl::OUString(aSearchLB.GetText());
+ pArgs[1].Name = ::rtl::OUString::createFromAscii("ParentWindow");
+ pArgs[1].Value <<= VCLUnoHelper::GetInterface( LAYOUT_THIS_WINDOW (this) );
+ if(pBtn == &aSearchComponent1PB)
+ {
+ if ( pImpl->xCommand1Dispatch.is() )
+ pImpl->xCommand1Dispatch->dispatch(pImpl->aCommand1URL, aArgs);
+ }
+ else
+ {
+ if ( pImpl->xCommand2Dispatch.is() )
+ pImpl->xCommand2Dispatch->dispatch(pImpl->aCommand2URL, aArgs);
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, ModifyHdl_Impl, ComboBox *, pEd )
+{
+ if ( !bSet )
+ SetModifyFlag_Impl( pEd );
+ else
+ bSet = sal_False;
+
+ if ( pEd == &aSearchLB || pEd == &aReplaceLB )
+ {
+ xub_StrLen nLBTxtLen = aSearchLB.GetText().Len(), nTxtLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nTxtLen = aSearchAttrText.GetText().Len();
+ else
+ nTxtLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( nLBTxtLen || nTxtLen )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ if (!bWriter || (bWriter && !aNotesBtn.IsChecked()))
+ {
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+ }
+ else
+ {
+ aSearchComponentFL.Enable(sal_False);
+ aSearchComponent1PB.Enable(sal_False);
+ aSearchComponent2PB.Enable(sal_False);
+ aSearchBtn.Disable();
+ aSearchAllBtn.Disable();
+ aReplaceBtn.Disable();
+ aReplaceAllBtn.Disable();
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, TemplateHdl_Impl, Button *, EMPTYARG )
+{
+ if ( pImpl->bSaveToModule )
+ SaveToModule_Impl();
+
+ if ( bFormat )
+ return 0;
+ String sDesc;
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ if ( !pFamilyController )
+ {
+ sal_uInt16 nId = 0;
+
+ // Vorlagen-Controller enablen
+ switch ( pSearchItem->GetFamily() )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ nId = SID_STYLE_FAMILY1; break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ nId = SID_STYLE_FAMILY2; break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ nId = SID_STYLE_FAMILY3; break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ nId = SID_STYLE_FAMILY4; break;
+
+ case SFX_STYLE_FAMILY_ALL:
+ break;
+
+ default:
+ DBG_ERROR( "StyleSheetFamily wurde geaendert?" );
+ }
+
+ rBindings.EnterRegistrations();
+ pFamilyController =
+ new SvxSearchController( nId, rBindings, *this );
+ rBindings.LeaveRegistrations();
+ aSearchTmplLB.Clear();
+ aReplaceTmplLB.Clear();
+
+ aSearchTmplLB.Show();
+ aReplaceTmplLB.Show();
+ aSearchLB.Hide();
+ aReplaceLB.Hide();
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ aSearchAttrText.SetText( sDesc );
+ aReplaceAttrText.SetText( sDesc );
+ }
+ else
+ {
+ pImpl->aSearchFormats.SetText( sDesc );
+ pImpl->aReplaceFormats.SetText( sDesc );
+ }
+ }
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+ else
+ {
+ // Vorlagen-Controller disablen
+ rBindings.EnterRegistrations();
+ DELETEZ( pFamilyController );
+ rBindings.LeaveRegistrations();
+
+ aSearchLB.Show();
+ aReplaceLB.Show();
+ aSearchTmplLB.Hide();
+ aReplaceTmplLB.Hide();
+
+ if ( !pImpl->bMultiLineEdit )
+ {
+ aSearchAttrText.SetText( BuildAttrText_Impl( sDesc, sal_True ) );
+ aReplaceAttrText.SetText( BuildAttrText_Impl( sDesc, sal_False ) );
+ }
+ else
+ {
+ pImpl->aSearchFormats.SetText( BuildAttrText_Impl( sDesc, sal_True ) );
+ pImpl->aReplaceFormats.SetText( BuildAttrText_Impl( sDesc, sal_False ) );
+ }
+
+ EnableControl_Impl( &aFormatBtn );
+ EnableControl_Impl( &aAttributeBtn );
+ EnableControl_Impl( &aSimilarityBox );
+
+ FocusHdl_Impl( bSearch ? &aSearchLB : &aReplaceLB );
+ }
+ bSet = sal_True;
+ pImpl->bSaveToModule = sal_False;
+ FlagHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::Remember_Impl( const String &rStr,sal_Bool _bSearch )
+{
+ if ( !rStr.Len() )
+ return;
+
+ SvStringsDtor* pArr = _bSearch ? &aSearchStrings : &aReplaceStrings;
+ ComboBox* pListBox = _bSearch ? &aSearchLB : &aReplaceLB;
+
+ // identische Strings ignorieren
+ for ( sal_uInt16 i = 0; i < pArr->Count(); ++i )
+ {
+ if ( COMPARE_EQUAL == (*pArr)[i]->CompareTo( rStr ) )
+ return;
+ }
+
+ // bei maximaler Belegung "altesten Eintrag l"oschen (ListBox und Array)
+ String* pInsStr;
+
+ if ( pArr->Count() >= REMEMBER_SIZE )
+ {
+ pInsStr = (*pArr)[REMEMBER_SIZE - 1];
+ pListBox->RemoveEntry( sal_uInt16(REMEMBER_SIZE - 1) );
+ pArr->Remove( REMEMBER_SIZE - 1 );
+ *pInsStr = rStr;
+ }
+ else
+ pInsStr = new String( rStr );
+
+ pArr->Insert( pInsStr, 0 );
+ pListBox->InsertEntry( *pInsStr, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
+{
+// SetUpdateMode( sal_False );
+ String aOldSrch( aSearchTmplLB .GetSelectEntry() );
+ String aOldRepl( aReplaceTmplLB.GetSelectEntry() );
+ aSearchTmplLB .Clear();
+ aReplaceTmplLB.Clear();
+ rPool.SetSearchMask( pSearchItem->GetFamily(), SFXSTYLEBIT_ALL );
+ aSearchTmplLB.SetUpdateMode( sal_False );
+ aReplaceTmplLB.SetUpdateMode( sal_False );
+ SfxStyleSheetBase* pBase = rPool.First();
+
+ while ( pBase )
+ {
+ if ( pBase->IsUsed() )
+ aSearchTmplLB.InsertEntry( pBase->GetName() );
+ aReplaceTmplLB.InsertEntry( pBase->GetName() );
+ pBase = rPool.Next();
+ }
+ aSearchTmplLB.SetUpdateMode( sal_True );
+ aReplaceTmplLB.SetUpdateMode( sal_True );
+ aSearchTmplLB.SelectEntryPos(0);
+
+ if ( aOldSrch.Len() )
+ aSearchTmplLB .SelectEntry( aOldSrch );
+ aReplaceTmplLB.SelectEntryPos(0);
+
+ if ( aOldRepl.Len() )
+ aReplaceTmplLB.SelectEntry( aOldRepl );
+
+ if ( aSearchTmplLB.GetEntryCount() )
+ {
+ EnableControl_Impl( &aSearchBtn );
+ EnableControl_Impl( &aSearchAllBtn );
+ EnableControl_Impl( &aReplaceBtn );
+ EnableControl_Impl( &aReplaceAllBtn );
+ }
+// FlagHdl_Impl(0);
+// SetUpdateMode( sal_True );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
+{
+ if ( nFlags == nOptions )
+ return;
+ else
+ nOptions = nFlags;
+
+ if ( !nOptions )
+ {
+ if ( IsVisible() )
+ {
+ Hide();
+ return;
+ }
+ }
+ else if ( !IsVisible() )
+ Show();
+ bool bNoSearch = sal_True;
+
+ sal_Bool bEnableSearch = ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0;
+ aSearchBtn.Enable(bEnableSearch);
+
+ if( bEnableSearch )
+ bNoSearch = sal_False;
+
+
+ if ( ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+ {
+ aSearchAllBtn.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ aSearchAllBtn.Disable();
+ if ( ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+ {
+ aReplaceBtn.Enable();
+ aReplaceText.Enable();
+ aReplaceLB.Enable();
+ aReplaceTmplLB.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ {
+ aReplaceBtn.Disable();
+ aReplaceText.Disable();
+ aReplaceLB.Disable();
+ aReplaceTmplLB.Disable();
+ }
+ if ( ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+ {
+ aReplaceAllBtn.Enable();
+ bNoSearch = sal_False;
+ }
+ else
+ aReplaceAllBtn.Disable();
+ aSearchComponentFL.Enable(!bNoSearch);
+ aSearchComponent1PB.Enable(!bNoSearch);
+ aSearchComponent2PB.Enable(!bNoSearch);
+ aSearchBtn.Enable( !bNoSearch );
+ aSearchText.Enable( !bNoSearch );
+ aSearchLB.Enable( !bNoSearch );
+
+ if ( ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+ aWordBtn.Enable();
+ else
+ aWordBtn.Disable();
+ if ( ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+ aBackwardsBtn.Enable();
+ else
+ aBackwardsBtn.Disable();
+ //!if ( ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 )
+ aNotesBtn.Enable();
+ //!else
+ //! aNotesBtn.Disable();
+ if ( ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0 )
+ aRegExpBtn.Enable();
+ else
+ aRegExpBtn.Disable();
+ if ( ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+ aMatchCaseCB.Enable();
+ else
+ aMatchCaseCB.Disable();
+ if ( ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+ aSelectionBtn.Enable();
+ else
+ aSelectionBtn.Disable();
+ if ( ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+ aLayoutBtn.Enable();
+ else
+ aLayoutBtn.Disable();
+ if ( ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aAttributeBtn.Enable();
+ aFormatBtn.Enable();
+ aNoFormatBtn.Enable();
+ }
+ else
+ {
+ aAttributeBtn.Disable();
+ aFormatBtn.Disable();
+ aNoFormatBtn.Disable();
+ }
+/*
+ if ( ( SEARCH_OPTIONS_MORE & nOptions ) != 0 &&
+ pSearchItem && pSearchItem->GetAppFlag() == SVX_SEARCHAPP_CALC )
+ pMoreBtn->Enable();
+ else
+ {
+ pMoreBtn->SetState( sal_False );
+ pMoreBtn->Disable();
+ }
+*/
+ if ( ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+ {
+ aSimilarityBox.Enable();
+ aSimilarityBtn.Enable();
+ }
+ else
+ {
+ aSimilarityBox.Disable();
+ aSimilarityBtn.Disable();
+ }
+
+ if ( pSearchItem )
+ Init_Impl( pSearchItem->GetPattern() &&
+ ( !pSearchList || !pSearchList->Count() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
+{
+ if ( &aSearchBtn == pCtrl && ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0 )
+ {
+ aSearchComponentFL.Enable();
+ aSearchComponent1PB.Enable();
+ aSearchComponent2PB.Enable();
+ aSearchBtn.Enable();
+ return;
+ }
+ if ( &aSearchAllBtn == pCtrl &&
+ ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+ {
+ aSearchAllBtn.Enable( ( bWriter || !aAllSheetsCB.IsChecked() ) );
+ return;
+ }
+ if ( &aReplaceBtn == pCtrl && ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+ {
+ aReplaceBtn.Enable();
+ return;
+ }
+ if ( &aReplaceAllBtn == pCtrl &&
+ ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+ {
+ aReplaceAllBtn.Enable();
+ return;
+ }
+ if ( &aWordBtn == pCtrl && ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+ {
+ aWordBtn.Enable();
+ return;
+ }
+ if ( &aBackwardsBtn == pCtrl && ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+ {
+ aBackwardsBtn.Enable();
+ return;
+ }
+ if ( &aNotesBtn == pCtrl /*! && ( SEARCH_OPTIONS_NOTES & nOptions ) != 0 */ )
+ {
+ aNotesBtn.Enable();
+ return;
+ }
+ if ( &aRegExpBtn == pCtrl && ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0
+ && !aSimilarityBox.IsChecked())
+ {
+ aRegExpBtn.Enable();
+ return;
+ }
+ if ( &aMatchCaseCB == pCtrl && ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+ {
+ if (!aJapOptionsCB.IsChecked())
+ aMatchCaseCB.Enable();
+ return;
+ }
+ if ( &aSelectionBtn == pCtrl && ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+ {
+ aSelectionBtn.Enable();
+ return;
+ }
+ if ( &aLayoutBtn == pCtrl && ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+ {
+ aLayoutBtn.Enable();
+ return;
+ }
+ if ( &aAttributeBtn == pCtrl
+ && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0
+ && pSearchList )
+ {
+ aAttributeBtn.Enable( pImpl->bFocusOnSearch );
+ }
+ if ( &aFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aFormatBtn.Enable();
+ return;
+ }
+ if ( &aNoFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+ {
+ aNoFormatBtn.Enable();
+ return;
+ }
+ if ( &aSimilarityBox == pCtrl &&
+ ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+ {
+ aSimilarityBox.Enable();
+
+ if ( aSimilarityBox.IsChecked() )
+ aSimilarityBtn.Enable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SetItem_Impl( const SvxSearchItem* pItem )
+{
+ if ( pItem )
+ {
+ delete pSearchItem;
+ pSearchItem = (SvxSearchItem*)pItem->Clone();
+ Init_Impl( pSearchItem->GetPattern() &&
+ ( !pSearchList || !pSearchList->Count() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FocusHdl_Impl, Control *, pCtrl )
+{
+ xub_StrLen nTxtLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nTxtLen = aSearchAttrText.GetText().Len();
+ else
+ nTxtLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( pCtrl == &aSearchLB || pCtrl == &pImpl->aSearchFormats )
+ {
+ if ( pCtrl->HasChildPathFocus() )
+ pImpl->bFocusOnSearch = sal_True;
+ pCtrl = &aSearchLB;
+ bSearch = sal_True;
+
+ if( nTxtLen )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+ EnableControl_Impl( &aAttributeBtn );
+ }
+ else
+ {
+ pImpl->bFocusOnSearch = sal_False;
+ pCtrl = &aReplaceLB;
+ bSearch = sal_False;
+
+ if ( ( !pImpl->bMultiLineEdit && aReplaceAttrText.GetText().Len() ) ||
+ ( pImpl->bMultiLineEdit && pImpl->aReplaceFormats.GetText().Len() ) )
+ EnableControl_Impl( &aNoFormatBtn );
+ else
+ aNoFormatBtn.Disable();
+ aAttributeBtn.Disable();
+ }
+ bSet = sal_True;
+
+ aSearchLB.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
+
+ ModifyHdl_Impl( (ComboBox*)pCtrl );
+
+ aLayoutBtn.SetText( bFormat && nTxtLen ? aLayoutStr : aStylesStr );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, LoseFocusHdl_Impl, Control *, EMPTYARG )
+{
+ SaveToModule_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, FormatHdl_Impl, Button *, EMPTYARG )
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ DBG_ASSERT( pSh, "no DocShell" );
+
+ if ( !pSh || !pImpl->pRanges )
+ return 0;
+
+ sal_sSize nCnt = 0;
+ const sal_uInt16* pPtr = pImpl->pRanges;
+ const sal_uInt16* pTmp = pPtr;
+
+ while( *pTmp )
+ pTmp++;
+ nCnt = pTmp - pPtr + 7;
+ sal_uInt16* pWhRanges = new sal_uInt16[nCnt];
+ sal_uInt16 nPos = 0;
+
+ while( *pPtr )
+ {
+ pWhRanges[nPos++] = *pPtr++;
+ }
+
+ pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
+ pWhRanges[nPos++] = SID_ATTR_PARA_MODEL;
+
+ sal_uInt16 nBrushWhich = pSh->GetPool().GetWhich(SID_ATTR_BRUSH);
+ pWhRanges[nPos++] = nBrushWhich;
+ pWhRanges[nPos++] = nBrushWhich;
+ pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION;
+ pWhRanges[nPos++] = SID_PARA_BACKGRND_DESTINATION;
+ pWhRanges[nPos] = 0;
+ SfxItemPool& rPool = pSh->GetPool();
+ SfxItemSet aSet( rPool, pWhRanges );
+ String aTxt;
+
+ aSet.InvalidateAllItems();
+ aSet.Put(SvxBrushItem(nBrushWhich));
+ aSet.Put(SfxUInt16Item(SID_PARA_BACKGRND_DESTINATION, PARA_DEST_CHAR));
+
+ if ( bSearch )
+ {
+ aTxt = SVX_RESSTR( RID_SVXSTR_SEARCH );
+ pSearchList->Get( aSet );
+ }
+ else
+ {
+ aTxt = SVX_RESSTR( RID_SVXSTR_REPLACE );
+ pReplaceList->Get( aSet );
+ }
+ aSet.DisableItem(SID_ATTR_PARA_MODEL);
+ aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_PAGEBREAK));
+ aSet.DisableItem(rPool.GetWhich(SID_ATTR_PARA_KEEP));
+
+ //CHINA001 SvxSearchFormatDialog* pDlg = new SvxSearchFormatDialog( this, aSet );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ SfxAbstractTabDialog* pDlg = pFact->CreateTabItemDialog( LAYOUT_THIS_WINDOW (this), aSet, RID_SVXDLG_SEARCHFORMAT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ aTxt.Insert( pDlg->GetText(), 0 );
+ pDlg->SetText( aTxt );
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ DBG_ASSERT( pDlg->GetOutputItemSet(), "invalid Output-Set" );
+ SfxItemSet aOutSet( *pDlg->GetOutputItemSet() );
+
+ SearchAttrItemList* pList = bSearch ? pSearchList : pReplaceList;
+
+ SearchAttrItem* pAItem;
+ const SfxPoolItem* pItem;
+ for( sal_uInt16 n = 0; n < pList->Count(); ++n )
+ if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) &&
+ SFX_ITEM_SET == aOutSet.GetItemState(
+ pAItem->pItem->Which(), sal_False, &pItem ) )
+ {
+ delete pAItem->pItem;
+ pAItem->pItem = pItem->Clone();
+ aOutSet.ClearItem( pAItem->pItem->Which() );
+ }
+
+ if( aOutSet.Count() )
+ pList->Put( aOutSet );
+
+ PaintAttrText_Impl(); // AttributText in GroupBox setzen
+ }
+ delete pDlg;
+ }
+ delete[] pWhRanges;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, NoFormatHdl_Impl, Button *, EMPTYARG )
+{
+ aLayoutBtn.SetText( aStylesStr );
+ bFormat = sal_False;
+ aLayoutBtn.Check( sal_False );
+
+ if ( bSearch )
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( String() );
+ else
+ pImpl->aSearchFormats.SetText( String() );
+ pSearchList->Clear();
+ }
+ else
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( String() );
+ else
+ pImpl->aReplaceFormats.SetText( String() );
+ pReplaceList->Clear();
+ }
+ pImpl->bSaveToModule = sal_False;
+ TemplateHdl_Impl( &aLayoutBtn );
+ pImpl->bSaveToModule = sal_True;
+ aNoFormatBtn.Disable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, AttributeHdl_Impl, Button *, EMPTYARG )
+{
+ if ( !pSearchList || !pImpl->pRanges )
+ return 0;
+
+ //CHINA001 SvxSearchAttributeDialog* pDlg = new SvxSearchAttributeDialog( this, *pSearchList, pImpl->pRanges );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ VclAbstractDialog* pDlg = pFact->CreateSvxSearchAttributeDialog( LAYOUT_THIS_WINDOW (this), *pSearchList, pImpl->pRanges );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ pDlg->Execute();
+ delete pDlg;
+ }
+ PaintAttrText_Impl();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxSearchDialog, TimeoutHdl_Impl, Timer *, pTimer )
+{
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+
+ if ( pViewShell )
+ {
+ if ( pViewShell->HasSelection( aSearchLB.IsVisible() ) )
+ EnableControl_Impl( &aSelectionBtn );
+ else
+ {
+ aSelectionBtn.Check( sal_False );
+ aSelectionBtn.Disable();
+ }
+ }
+
+ pTimer->Start();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::GetSearchItems( SfxItemSet& rSet )
+{
+ xub_StrLen nLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nLen = aSearchAttrText.GetText().Len();
+ else
+ nLen = pImpl->aSearchFormats.GetText().Len();
+
+ if ( nLen && pSearchList )
+ pSearchList->Get( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::GetReplaceItems( SfxItemSet& rSet )
+{
+ xub_StrLen nLen;
+
+ if ( !pImpl->bMultiLineEdit )
+ nLen = aReplaceAttrText.GetText().Len();
+ else
+ nLen = pImpl->aReplaceFormats.GetText().Len();
+
+ if ( nLen && pReplaceList )
+ pReplaceList->Get( rSet );
+}
+
+// -----------------------------------------------------------------------
+
+String& SvxSearchDialog::BuildAttrText_Impl( String& rStr,
+ sal_Bool bSrchFlag ) const
+{
+ if ( rStr.Len() )
+ rStr.Erase();
+
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ DBG_ASSERT( pSh, "no DocShell" );
+
+ if ( !pSh )
+ return rStr;
+
+ SfxItemPool& rPool = pSh->GetPool();
+ SearchAttrItemList* pList = bSrchFlag ? pSearchList : pReplaceList;
+
+ if ( !pList )
+ return rStr;
+
+ // Metrik abfragen
+ SfxMapUnit eMapUnit = SFX_MAPUNIT_CM;
+ FieldUnit eFieldUnit = pSh->GetModule()->GetFieldUnit();
+ switch ( eFieldUnit )
+ {
+ case FUNIT_MM: eMapUnit = SFX_MAPUNIT_MM; break;
+ case FUNIT_CM:
+ case FUNIT_M:
+ case FUNIT_KM: eMapUnit = SFX_MAPUNIT_CM; break;
+ case FUNIT_TWIP: eMapUnit = SFX_MAPUNIT_TWIP; break;
+ case FUNIT_POINT:
+ case FUNIT_PICA: eMapUnit = SFX_MAPUNIT_POINT; break;
+ case FUNIT_INCH:
+ case FUNIT_FOOT:
+ case FUNIT_MILE: eMapUnit = SFX_MAPUNIT_INCH; break;
+ case FUNIT_100TH_MM: eMapUnit = SFX_MAPUNIT_100TH_MM; break;
+ default: ;//prevent warning
+ }
+
+ ResStringArray aAttrNames( SVX_RES( RID_ATTR_NAMES ) );
+
+ for ( sal_uInt16 i = 0; i < pList->Count(); ++i )
+ {
+ const SearchAttrItem& rItem = pList->GetObject(i);
+
+ if ( rStr.Len() )
+ rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) );
+
+ if ( !IsInvalidItem( rItem.pItem ) )
+ {
+ String aStr;
+ rPool.GetPresentation( *rItem.pItem,
+ SFX_ITEM_PRESENTATION_COMPLETE,
+ eMapUnit, aStr );
+ rStr += aStr;
+ }
+ else if ( rItem.nSlot == SID_ATTR_BRUSH_CHAR )
+ {
+ //Sonderbehandlung fuer Zeichenhintergrund
+ rStr += SVX_RESSTR( RID_SVXITEMS_BRUSH_CHAR );
+ }
+ else
+ {
+ sal_uInt32 nId = aAttrNames.FindIndex( rItem.nSlot );
+ if ( RESARRAY_INDEX_NOTFOUND != nId )
+ rStr += aAttrNames.GetString( nId );
+ }
+ }
+ return rStr;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::PaintAttrText_Impl()
+{
+ String aDesc;
+ BuildAttrText_Impl( aDesc, bSearch );
+
+ if ( !bFormat && aDesc.Len() )
+ bFormat = sal_True;
+
+ if ( bSearch )
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aSearchAttrText.SetText( aDesc );
+ else
+ pImpl->aSearchFormats.SetText( aDesc );
+ FocusHdl_Impl( &aSearchLB );
+ }
+ else
+ {
+ if ( !pImpl->bMultiLineEdit )
+ aReplaceAttrText.SetText( aDesc );
+ else
+ pImpl->aReplaceFormats.SetText( aDesc );
+ FocusHdl_Impl( &aReplaceLB );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SetModifyFlag_Impl( const Control* pCtrl )
+{
+ if ( &aSearchLB == (ComboBox*)pCtrl )
+ nModifyFlag |= MODIFY_SEARCH;
+ else if ( &aReplaceLB == (ComboBox*)pCtrl )
+ nModifyFlag |= MODIFY_REPLACE;
+ else if ( &aWordBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_WORD;
+ else if ( &aMatchCaseCB == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_EXACT;
+ else if ( &aBackwardsBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_BACKWARDS;
+ else if ( &aNotesBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_NOTES;
+ else if ( &aSelectionBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_SELECTION;
+ else if ( &aRegExpBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_REGEXP;
+ else if ( &aLayoutBtn == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_LAYOUT;
+ else if ( &aSimilarityBox == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_SIMILARITY;
+ else if ( &aCalcSearchInLB == (ListBox*)pCtrl )
+ {
+ nModifyFlag |= MODIFY_FORMULAS;
+ nModifyFlag |= MODIFY_VALUES;
+ nModifyFlag |= MODIFY_CALC_NOTES;
+ }
+ else if ( &aRowsBtn == (RadioButton*)pCtrl )
+ nModifyFlag |= MODIFY_ROWS;
+ else if ( &aColumnsBtn == (RadioButton*)pCtrl )
+ nModifyFlag |= MODIFY_COLUMNS;
+ else if ( &aAllSheetsCB == (CheckBox*)pCtrl )
+ nModifyFlag |= MODIFY_ALLTABLES;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxSearchDialog::SaveToModule_Impl()
+{
+ if ( !pSearchItem )
+ return;
+
+ if ( aLayoutBtn.IsChecked() )
+ {
+ pSearchItem->SetSearchString ( aSearchTmplLB.GetSelectEntry() );
+ pSearchItem->SetReplaceString( aReplaceTmplLB.GetSelectEntry() );
+ }
+ else
+ {
+ pSearchItem->SetSearchString ( aSearchLB.GetText() );
+ pSearchItem->SetReplaceString( aReplaceLB.GetText() );
+ Remember_Impl( aSearchLB.GetText(), sal_True );
+ }
+
+ pSearchItem->SetRegExp( sal_False );
+ pSearchItem->SetLevenshtein( sal_False );
+ if (GetCheckBoxValue( aRegExpBtn ))
+ pSearchItem->SetRegExp( sal_True );
+ else if (GetCheckBoxValue( aSimilarityBox ))
+ pSearchItem->SetLevenshtein( sal_True );
+
+ pSearchItem->SetWordOnly( GetCheckBoxValue( aWordBtn ) );
+ pSearchItem->SetBackward( GetCheckBoxValue( aBackwardsBtn ) );
+ pSearchItem->SetNotes( GetCheckBoxValue( aNotesBtn ) );
+ pSearchItem->SetPattern( GetCheckBoxValue( aLayoutBtn ) );
+ pSearchItem->SetSelection( GetCheckBoxValue( aSelectionBtn ) );
+
+ pSearchItem->SetUseAsianOptions( GetCheckBoxValue( aJapOptionsCB ) );
+ sal_Int32 nFlags = GetTransliterationFlags();
+ if( !pSearchItem->IsUseAsianOptions())
+ nFlags &= (TransliterationModules_IGNORE_CASE |
+ TransliterationModules_IGNORE_WIDTH );
+ pSearchItem->SetTransliterationFlags( nFlags );
+
+ if ( !bWriter )
+ {
+ if ( aCalcSearchInLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ pSearchItem->SetCellType( aCalcSearchInLB.GetSelectEntryPos() );
+
+ pSearchItem->SetRowDirection( aRowsBtn.IsChecked() );
+ pSearchItem->SetAllTables( aAllSheetsCB.IsChecked() );
+ }
+
+ pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ nModifyFlag = 0;
+ const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
+ rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs );
+}
+
+// class SvxSearchDialogWrapper ------------------------------------------
+
+SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG);
+
+// -----------------------------------------------------------------------
+
+SvxSearchDialogWrapper::SvxSearchDialogWrapper( Window* _pParent, sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo )
+ : SfxChildWindow( _pParent, nId )
+ , dialog (new SvxSearchDialog (_pParent, this, *pBindings))
+{
+ pWindow = LAYOUT_THIS_WINDOW (dialog);
+ dialog->Initialize( pInfo );
+
+ pBindings->Update( SID_SEARCH_ITEM );
+ pBindings->Update( SID_SEARCH_OPTIONS );
+ pBindings->Update( SID_SEARCH_SEARCHSET );
+ pBindings->Update( SID_SEARCH_REPLACESET );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+ dialog->bConstruct = sal_False;
+}
+
+SvxSearchDialogWrapper::~SvxSearchDialogWrapper ()
+{
+#if ENABLE_LAYOUT
+ delete dialog;
+ pWindow = 0;
+#endif /* ENABLE_LAYOUT */
+}
+
+SvxSearchDialog *SvxSearchDialogWrapper::getDialog ()
+{
+ return dialog;
+}
+
+// -----------------------------------------------------------------------
+
+SfxChildWinInfo SvxSearchDialogWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ aInfo.bVisible = sal_False;
+ return aInfo;
+}
+
diff --git a/svx/source/dialog/srchdlg.hrc b/svx/source/dialog/srchdlg.hrc
new file mode 100644
index 000000000000..6632b11fd7c8
--- /dev/null
+++ b/svx/source/dialog/srchdlg.hrc
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_SRCHDLG_HRC
+#define _SVX_SRCHDLG_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_SEARCH 10
+#define ED_SEARCH 11
+#define LB_SEARCH 12
+#define FT_SEARCH_ATTR 13
+#define FT_SEARCH_FORMATS 14
+#define FT_REPLACE 15
+#define ED_REPLACE 16
+#define LB_REPLACE 17
+#define FT_REPLACE_ATTR 18
+#define FT_REPLACE_FORMATS 19
+
+#define BTN_SEARCH 20
+#define BTN_SEARCH_ALL 21
+#define FL_SEARCH_COMMAND 22
+#define BTN_REPLACE 23
+#define BTN_REPLACE_ALL 24
+
+#define CB_MATCH_CASE 25
+#define CB_WHOLE_WORDS 26
+#define FL_SEARCH_COMPONENT 27
+#define BTN_COMPONENT_1 28
+#define BTN_COMPONENT_2 29
+
+#define FL_BUTTONS 30
+#define BTN_MORE 31
+#define BTN_HELP 32
+#define BTN_CLOSE 33
+
+#define FL_OPTIONS 40
+#define CB_SELECTIONS 41
+#define CB_BACKWARDS 42
+#define CB_REGEXP 43
+#define CB_SIMILARITY 44
+#define PB_SIMILARITY 45
+#define CB_LAYOUTS 46
+#define CB_JAP_MATCH_FULL_HALF_WIDTH 47
+#define CB_JAP_SOUNDS_LIKE 48
+#define PB_JAP_OPTIONS 49
+
+#define BTN_ATTRIBUTE 50
+#define BTN_FORMAT 51
+#define BTN_NOFORMAT 52
+
+#define FL_CALC 53
+#define FT_CALC_SEARCHIN 54
+#define LB_CALC_SEARCHIN 55
+#define FT_CALC_SEARCHDIR 56
+#define RB_CALC_ROWS 57
+#define RB_CALC_COLUMNS 58
+#define CB_ALL_SHEETS 59
+
+#define CB_NOTES 60
+
+#define IMG_MOREBTN_DOWN 100
+#define IMG_MOREBTN_UP 101
+
+#define STR_WORDCALC 100
+#define STR_MORE_BTN 101
+#define STR_LESS_BTN 102
+
+#endif // #ifndef _SVX_SRCHDLG_HRC
+
diff --git a/svx/source/dialog/srchdlg.src b/svx/source/dialog/srchdlg.src
new file mode 100644
index 000000000000..f82d4f06cb88
--- /dev/null
+++ b/svx/source/dialog/srchdlg.src
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+#include "srchdlg.hrc"
+#include <sfx2/sfxcommands.h>
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } ;
+
+ // Strings ---------------------------------------------------------------
+
+String RID_SVXSTR_SEARCH_STYLES
+{
+ Text [ en-US ] = "Including Styles" ;
+};
+String RID_SVXSTR_SEARCH
+{
+ Text [ en-US ] = "(Search)" ;
+};
+String RID_SVXSTR_REPLACE
+{
+ Text [ en-US ] = "(Replace)" ;
+};
+
+ // RID_SVXDLG_SEARCH -----------------------------------------------------
+
+ModelessDialog RID_SVXDLG_SEARCH
+{
+ HelpId = CMD_SID_SEARCH_DLG ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 155 ) ;
+ Text [ en-US ] = "Find & Replace" ;
+ Moveable = TRUE ;
+ FixedText FT_SEARCH
+ {
+ Pos = MAP_APPFONT ( 6 , 7 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "~Search for" ;
+ };
+ ComboBox ED_SEARCH
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_SEARCH:ED_SEARCH";
+ Pos = MAP_APPFONT ( 6 , 18 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_SEARCH
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_SEARCH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 18 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_SEARCH_ATTR
+ {
+ Pos = MAP_APPFONT ( 9 , 35 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_SEARCH_FORMATS
+ {
+ Pos = MAP_APPFONT ( 9 , 35 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_REPLACE
+ {
+ Pos = MAP_APPFONT ( 6 , 54 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Re~place with" ;
+ };
+ ComboBox ED_REPLACE
+ {
+ HelpID = "svx:ComboBox:RID_SVXDLG_SEARCH:ED_REPLACE";
+ Pos = MAP_APPFONT ( 6 , 65 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_REPLACE
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_REPLACE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 65 ) ;
+ Size = MAP_APPFONT ( 132 , 98 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_REPLACE_ATTR
+ {
+ Pos = MAP_APPFONT ( 9 , 82 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_REPLACE_FORMATS
+ {
+ Pos = MAP_APPFONT ( 9 , 82 ) ;
+ Size = MAP_APPFONT ( 129 , 16 ) ;
+ WordBreak = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_SEARCH
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_SEARCH";
+ Pos = MAP_APPFONT ( 144 , 9 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Find" ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ PushButton BTN_SEARCH_ALL
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_SEARCH_ALL";
+ Pos = MAP_APPFONT ( 144 , 26 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Find ~All" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEARCH_COMMAND
+ {
+ Pos = MAP_APPFONT ( 141 , 44 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ };
+ PushButton BTN_REPLACE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_REPLACE";
+ Pos = MAP_APPFONT ( 144 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Replace" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_REPLACE_ALL
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_REPLACE_ALL";
+ Pos = MAP_APPFONT ( 144 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Replace A~ll" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SEARCH_COMPONENT
+ {
+ Pos = MAP_APPFONT ( 141 , 91 ) ;
+ Size = MAP_APPFONT ( 56 , 8 ) ;
+ Hide = TRUE;
+ };
+ PushButton BTN_COMPONENT_1
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_COMPONENT_1";
+ Pos = MAP_APPFONT ( 144 , 103 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE;
+ };
+ PushButton BTN_COMPONENT_2
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_COMPONENT_2";
+ Pos = MAP_APPFONT ( 144 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE;
+ };
+ CheckBox CB_MATCH_CASE
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_MATCH_CASE";
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ma~tch case";
+ };
+ CheckBox CB_WHOLE_WORDS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_WHOLE_WORDS";
+ Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Whole wor~ds only" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT ( 0 , 124 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ };
+ MoreButton BTN_MORE
+ {
+ HelpID = "svx:MoreButton:RID_SVXDLG_SEARCH:BTN_MORE";
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ MapUnit = MAP_APPFONT ;
+ Delta = 174 ;
+ State = FALSE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 88 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CLOSE
+ {
+ Pos = MAP_APPFONT ( 144 , 135 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Close" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 152 ) ;
+ Size = MAP_APPFONT ( 191 , 8 ) ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_SELECTIONS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_SELECTIONS";
+ Pos = MAP_APPFONT ( 12 , 163 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "C~urrent selection only" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_BACKWARDS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_BACKWARDS";
+ Pos = MAP_APPFONT ( 12 , 176 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Bac~kwards" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_REGEXP
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_REGEXP";
+ Pos = MAP_APPFONT ( 12 , 189 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Regular e~xpressions" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_SIMILARITY
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_SIMILARITY";
+ Pos = MAP_APPFONT ( 12 , 204 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text [ en-US ] = "S~imilarity search" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton PB_SIMILARITY
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:PB_SIMILARITY";
+ Pos = MAP_APPFONT ( 124 , 202 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_LAYOUTS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_LAYOUTS";
+ Pos = MAP_APPFONT ( 12 , 219 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Search for St~yles" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_NOTES
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_NOTES";
+ Pos = MAP_APPFONT ( 12 , 232 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Notes";
+ };
+ CheckBox CB_JAP_MATCH_FULL_HALF_WIDTH
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_JAP_MATCH_FULL_HALF_WIDTH";
+ Pos = MAP_APPFONT ( 12 , 247 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Match character width";
+ Hide = TRUE ;
+ };
+ CheckBox CB_JAP_SOUNDS_LIKE
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_JAP_SOUNDS_LIKE";
+ Pos = MAP_APPFONT ( 12 , 260 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sounds like (Japanese)";
+ Hide = TRUE ;
+ };
+ PushButton PB_JAP_OPTIONS
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:PB_JAP_OPTIONS";
+ Pos = MAP_APPFONT ( 124 , 258 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_ATTRIBUTE
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_ATTRIBUTE";
+ Pos = MAP_APPFONT ( 144 , 163 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Attri~butes..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_FORMAT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_FORMAT";
+ Pos = MAP_APPFONT ( 144 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "For~mat..." ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BTN_NOFORMAT
+ {
+ HelpID = "svx:PushButton:RID_SVXDLG_SEARCH:BTN_NOFORMAT";
+ Pos = MAP_APPFONT ( 144 , 197 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~No Format" ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedLine FL_CALC
+ {
+ Pos = MAP_APPFONT ( 6 , 272 ) ;
+ Size = MAP_APPFONT ( 191 , 8 ) ;
+ Hide = TRUE ;
+ };
+ FixedText FT_CALC_SEARCHIN
+ {
+ Pos = MAP_APPFONT ( 12 , 285 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Search i~n" ;
+ Hide = TRUE ;
+ };
+ ListBox LB_CALC_SEARCHIN
+ {
+ HelpID = "svx:ListBox:RID_SVXDLG_SEARCH:LB_CALC_SEARCHIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 283 ) ;
+ Size = MAP_APPFONT ( 63 , 48 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Formulas" ; Default ; > ;
+ < "Values" ; Default ; > ;
+ < "Notes" ; Default ; > ;
+ };
+ };
+ FixedText FT_CALC_SEARCHDIR
+ {
+ Pos = MAP_APPFONT ( 12 , 300 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Search ~direction" ;
+ Hide = TRUE ;
+ };
+ RadioButton RB_CALC_ROWS
+ {
+ HelpID = "svx:RadioButton:RID_SVXDLG_SEARCH:RB_CALC_ROWS";
+ Pos = MAP_APPFONT ( 75 , 300 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Ro~ws" ;
+ Hide = TRUE ;
+ };
+ RadioButton RB_CALC_COLUMNS
+ {
+ HelpID = "svx:RadioButton:RID_SVXDLG_SEARCH:RB_CALC_COLUMNS";
+ Pos = MAP_APPFONT ( 75 , 313 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "Colu~mns" ;
+ Hide = TRUE ;
+ };
+ CheckBox CB_ALL_SHEETS
+ {
+ HelpID = "svx:CheckBox:RID_SVXDLG_SEARCH:CB_ALL_SHEETS";
+ Pos = MAP_APPFONT ( 12 , 326 ) ;
+ Size = MAP_APPFONT ( 126 , 10 ) ;
+ Text [ en-US ] = "Search in all sheets" ;
+ Hide = TRUE ;
+ };
+
+ String STR_WORDCALC
+ {
+ Text [ en-US ] = "~Entire cells" ;
+ };
+ String STR_MORE_BTN
+ {
+ Text [ en-US ] = "More ~Options" ;
+ };
+ String STR_LESS_BTN
+ {
+ Text [ en-US ] = "Fewer ~Options" ;
+ };
+};
+
+ // ********************************************************************** EOF
+
diff --git a/svx/source/dialog/stddlg.cxx b/svx/source/dialog/stddlg.cxx
new file mode 100644
index 000000000000..0cd6421f5a77
--- /dev/null
+++ b/svx/source/dialog/stddlg.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// include ---------------------------------------------------------------
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#include <svx/stddlg.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+
+// class SvxStandardDialog -----------------------------------------------
+
+short SvxStandardDialog::Execute()
+{
+ short nRet = ModalDialog::Execute();
+
+ if ( RET_OK == nRet )
+ Apply();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+SvxStandardDialog::SvxStandardDialog( Window *pParent, const ResId &rResId ) :
+ SfxModalDialog( pParent, rResId )
+{
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT SvxStandardDialog::~SvxStandardDialog()
+{
+}
+
+
+
diff --git a/svx/source/dialog/strarray.cxx b/svx/source/dialog/strarray.cxx
new file mode 100644
index 000000000000..47cb66850e9f
--- /dev/null
+++ b/svx/source/dialog/strarray.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <tools/shl.hxx>
+
+// include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc> // -> RID_SVXSTR_LANGUAGE_TABLE
+#include <svx/dialmgr.hxx>
+#include <svx/strarray.hxx>
+
+//------------------------------------------------------------------------
+
+SvxStringArray::SvxStringArray( sal_uInt32 nResId ) :
+
+ ResStringArray( SVX_RES( nResId ) )
+
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxStringArray::SvxStringArray( const ResId& rResId ) :
+ ResStringArray( rResId )
+{
+}
+
+
+//------------------------------------------------------------------------
+
+SvxStringArray::~SvxStringArray()
+{
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxStringArray::GetStringByPos( sal_uInt32 nPos ) const
+{
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+ else
+ return String::EmptyString();
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxStringArray::GetStringByType( long nType ) const
+{
+ sal_uInt32 nPos = FindIndex( nType );
+
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+ else
+ return String::EmptyString();
+}
+
+//------------------------------------------------------------------------
+
+long SvxStringArray::GetValueByStr( const String& rStr ) const
+{
+ long nType = 0;
+ sal_uInt32 nCount = Count();
+
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ if ( rStr == ResStringArray::GetString( i ) )
+ {
+ nType = GetValue( i );
+ break;
+ }
+ return nType;
+}
+
+
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx
new file mode 100644
index 000000000000..dd4b03147445
--- /dev/null
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/dialmgr.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/valueset.hxx>
+#include <svl/languageoptions.hxx>
+#ifndef _SVX_HELPID_HRC
+#include <helpid.hrc>
+#endif
+#include <editeng/numitem.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/svapp.hxx>
+#include <svx/gallery.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/brshitem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/dlgutil.hxx>
+#ifndef _XTABLE_HXX //autogen
+
+#include <svx/xtable.hxx>
+#endif
+#include <svx/drawitem.hxx>
+#include <svx/numvset.hxx>
+#include <svx/htmlmode.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingFormatter.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+
+#include <algorithm>
+#include <sfx2/opengrf.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::text;
+using namespace com::sun::star::container;
+using namespace com::sun::star::style;
+using rtl::OUString;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define NUM_PAGETYPE_BULLET 0
+#define NUM_PAGETYPE_SINGLENUM 1
+#define NUM_PAGETYPE_NUM 2
+#define NUM_PAGETYPE_BMP 3
+#define PAGETYPE_USER_START 10
+
+#define SHOW_NUMBERING 0
+#define SHOW_BULLET 1
+#define SHOW_BITMAP 2
+
+#define MAX_BMP_WIDTH 16
+#define MAX_BMP_HEIGHT 16
+
+static const sal_Char cNumberingType[] = "NumberingType";
+static const sal_Char cValue[] = "Value";
+static const sal_Char cParentNumbering[] = "ParentNumbering";
+static const sal_Char cPrefix[] = "Prefix";
+static const sal_Char cSuffix[] = "Suffix";
+static const sal_Char cBulletChar[] = "BulletChar";
+static const sal_Char cBulletFontName[] = "BulletFontName";
+
+/* -----------------28.10.98 08:32-------------------
+ *
+ * --------------------------------------------------*/
+// Die Auswahl an Bullets aus den StarSymbol
+static const sal_Unicode aBulletTypes[] =
+{
+ 0x2022,
+ 0x25cf,
+ 0xe00c,
+ 0xe00a,
+ 0x2794,
+ 0x27a2,
+ 0x2717,
+ 0x2714
+};
+
+static Font& lcl_GetDefaultBulletFont()
+{
+ static sal_Bool bInit = 0;
+ static Font aDefBulletFont( UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ),
+ String(), Size( 0, 14 ) );
+ if(!bInit)
+ {
+ aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
+ aDefBulletFont.SetPitch( PITCH_DONTKNOW );
+ aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
+ aDefBulletFont.SetTransparent( sal_True );
+ bInit = sal_True;
+ }
+ return aDefBulletFont;
+}
+
+static void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 nNumberingType,
+ const OUString& rBulletChar, const OUString& rText, const OUString& rFontName,
+ Point& rLeft, Font& rRuleFont, const Font& rTextFont)
+{
+
+ if(NumberingType::CHAR_SPECIAL == nNumberingType )
+ {
+ rRuleFont.SetStyleName(rFontName);
+ pVDev->SetFont(rRuleFont);
+ pVDev->DrawText(rLeft, rBulletChar);
+ rLeft.X() += pVDev->GetTextWidth(rBulletChar);
+ }
+ else
+ {
+ pVDev->SetFont(rTextFont);
+ pVDev->DrawText(rLeft, rText);
+ rLeft.X() += pVDev->GetTextWidth(rText);
+ }
+}
+void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ static sal_uInt16 __READONLY_DATA aLinesArr[] =
+ {
+ 15, 10,
+ 20, 30,
+ 25, 50,
+ 30, 70,
+ 35, 90, // up to here line positions
+ 05, 10, // character positions
+ 10, 30,
+ 15, 50,
+ 20, 70,
+ 25, 90,
+ };
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color aBackColor = rStyleSettings.GetFieldColor();
+ const Color aTextColor = rStyleSettings.GetFieldTextColor();
+
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ Rectangle aRect = rUDEvt.GetRect();
+ sal_uInt16 nItemId = rUDEvt.GetItemId();
+ long nRectWidth = aRect.GetWidth();
+ long nRectHeight = aRect.GetHeight();
+ Size aRectSize(nRectWidth, aRect.GetHeight());
+ Point aBLPos = aRect.TopLeft();
+ Font aOldFont = pDev->GetFont();
+ Color aOldColor = pDev->GetLineColor();
+ pDev->SetLineColor(aTextColor);
+ Font aFont(OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE));
+
+ Size aSize = aFont.GetSize();
+
+ Font aRuleFont( lcl_GetDefaultBulletFont() );
+ aSize.Height() = nRectHeight/6;
+ aRuleFont.SetSize(aSize);
+ aRuleFont.SetColor(aTextColor);
+ aRuleFont.SetFillColor(aBackColor);
+ if(nPageType == NUM_PAGETYPE_BULLET)
+ aFont = aRuleFont;
+ else if(nPageType == NUM_PAGETYPE_NUM)
+ {
+ aSize.Height() = nRectHeight/8;
+ }
+ aFont.SetColor(aTextColor);
+ aFont.SetFillColor(aBackColor);
+ aFont.SetSize( aSize );
+ pDev->SetFont(aFont);
+
+ if(!pVDev)
+ {
+ // Die Linien werden nur einmalig in das VirtualDevice gepainted
+ // nur die Gliederungspage bekommt es aktuell
+ pVDev = new VirtualDevice(*pDev);
+ pVDev->SetMapMode(pDev->GetMapMode());
+ pVDev->EnableRTL( IsRTLEnabled() );
+ pVDev->SetOutputSize( aRectSize );
+ aOrgRect = aRect;
+ pVDev->SetFillColor( aBackColor );
+ pVDev->DrawRect(aOrgRect);
+
+ if(aBackColor == aLineColor)
+ aLineColor.Invert();
+ pVDev->SetLineColor(aLineColor);
+ // Linien nur einmalig Zeichnen
+ if(nPageType != NUM_PAGETYPE_NUM)
+ {
+ Point aStart(aBLPos.X() + nRectWidth *25 / 100,0);
+ Point aEnd(aBLPos.X() + nRectWidth * 9 / 10,0);
+ for( sal_uInt16 i = 11; i < 100; i += 33)
+ {
+ aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * i / 100;
+ pVDev->DrawLine(aStart, aEnd);
+ aStart.Y() = aEnd.Y() = aBLPos.Y() + nRectHeight * (i + 11) / 100;
+ pVDev->DrawLine(aStart, aEnd);
+ }
+ }
+ }
+ pDev->DrawOutDev( aRect.TopLeft(), aRectSize,
+ aOrgRect.TopLeft(), aRectSize,
+ *pVDev );
+ // jetzt kommt der Text
+ const OUString sValue(C2U(cValue));
+ if( NUM_PAGETYPE_SINGLENUM == nPageType ||
+ NUM_PAGETYPE_BULLET == nPageType )
+ {
+ Point aStart(aBLPos.X() + nRectWidth / 9,0);
+ for( sal_uInt16 i = 0; i < 3; i++ )
+ {
+ sal_uInt16 nY = 11 + i * 33;
+ aStart.Y() = aBLPos.Y() + nRectHeight * nY / 100;
+ String sText;
+ if(nPageType == NUM_PAGETYPE_BULLET)
+ {
+ sText = aBulletTypes[nItemId - 1];
+ aStart.Y() -= pDev->GetTextHeight()/2;
+ aStart.X() = aBLPos.X() + 5;
+ }
+ else
+ {
+ if(xFormatter.is() && aNumSettings.getLength() > nItemId - 1)
+ {
+ Sequence<PropertyValue> aLevel = aNumSettings.getConstArray()[nItemId - 1];
+ try
+ {
+ aLevel.realloc(aLevel.getLength() + 1);
+ PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1];
+ rValue.Name = sValue;
+ rValue.Value <<= (sal_Int32)(i + 1);
+ sText = xFormatter->makeNumberingString( aLevel, aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString");
+ }
+ }
+ // knapp neben dem linken Rand beginnen
+ aStart.X() = aBLPos.X() + 2;
+ aStart.Y() -= pDev->GetTextHeight()/2;
+ }
+ pDev->DrawText(aStart, sText);
+ }
+ }
+ else if(NUM_PAGETYPE_NUM == nPageType )
+ {
+ // Outline numbering has to be painted into the virtual device
+ // to get correct lines
+ // has to be made again
+ pVDev->DrawRect(aOrgRect);
+ long nStartX = aOrgRect.TopLeft().X();
+ long nStartY = aOrgRect.TopLeft().Y();
+
+ if(xFormatter.is() && aOutlineSettings.getLength() > nItemId - 1)
+ {
+ Reference<XIndexAccess> xLevel = aOutlineSettings.getArray()[nItemId - 1];
+ try
+ {
+ OUString sLevelTexts[5];
+ OUString sFontNames[5];
+ OUString sBulletChars[5];
+ sal_Int16 aNumberingTypes[5];
+ OUString sPrefixes[5];
+ OUString sSuffixes[5];
+ sal_Int16 aParentNumberings[5];
+
+ sal_Int32 nLevelCount = xLevel->getCount();
+ if(nLevelCount > 5)
+ nLevelCount = 5;
+ for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
+ {
+ long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
+ Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
+
+ Any aLevelAny = xLevel->getByIndex(i);
+ Sequence<PropertyValue> aLevel;
+ aLevelAny >>= aLevel;
+ const PropertyValue* pValues = aLevel.getConstArray();
+ aNumberingTypes[i] = 0;
+ for(sal_Int32 nProperty = 0; nProperty < aLevel.getLength() - 1; nProperty++)
+ {
+ if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cNumberingType)))
+ pValues[nProperty].Value >>= aNumberingTypes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletFontName)))
+ pValues[nProperty].Value >>= sFontNames[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cBulletChar)))
+ pValues[nProperty].Value >>= sBulletChars[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cPrefix)))
+ pValues[nProperty].Value >>= sPrefixes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSuffix)))
+ pValues[nProperty].Value >>= sSuffixes[i];
+ else if(pValues[nProperty].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cParentNumbering)))
+ pValues[nProperty].Value >>= aParentNumberings[i];
+ }
+ Sequence< PropertyValue > aProperties(2);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingType"));
+ pProperties[0].Value <<= aNumberingTypes[i];
+ pProperties[1].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Value"));
+ pProperties[1].Value <<= (sal_Int32)1;
+ try
+ {
+ sLevelTexts[i] = xFormatter->makeNumberingString( aProperties, aLocale );
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception in DefaultNumberingProvider::makeNumberingString");
+ }
+
+ aLeft.Y() -= (pDev->GetTextHeight()/2);
+ if(sPrefixes[i].getLength() &&
+ !sPrefixes[i].equalsAsciiL(" ", 1) &&
+ sPrefixes[i].getStr()[0] != 0)
+ {
+ pVDev->SetFont(aFont);
+ pVDev->DrawText(aLeft, sPrefixes[i]);
+ aLeft.X() += pDev->GetTextWidth(sPrefixes[i]);
+ }
+ if(aParentNumberings[i])
+ {
+ //insert old numberings here
+ sal_Int32 nStartLevel = std::min((sal_Int32)aParentNumberings[i], i);
+ for(sal_Int32 nParentLevel = i - nStartLevel; nParentLevel < i; nParentLevel++)
+ {
+ OUString sTmp(sLevelTexts[nParentLevel]);
+ sTmp += C2U(".");
+ lcl_PaintLevel(pVDev,
+ aNumberingTypes[nParentLevel],
+ sBulletChars[nParentLevel],
+ sTmp,
+ sFontNames[nParentLevel],
+ aLeft,
+ aRuleFont,
+ aFont);
+ }
+ }
+ lcl_PaintLevel(pVDev,
+ aNumberingTypes[i],
+ sBulletChars[i],
+ sLevelTexts[i],
+ sFontNames[i],
+ aLeft,
+ aRuleFont,
+ aFont);
+ if(sSuffixes[i].getLength()&&
+ !sSuffixes[i].equalsAsciiL(" ", 1) &&
+ sSuffixes[i].getStr()[0] != 0)
+ {
+ pVDev->SetFont(aFont);
+ pVDev->DrawText(aLeft, sSuffixes[i]);
+ aLeft.X() += pDev->GetTextWidth(sSuffixes[i]);
+ }
+
+ long nLineTop = nStartY + nRectHeight * aLinesArr[2 * i + 1]/100 ;
+ Point aLineLeft(aLeft.X() /*+ nStartX + nRectWidth * aLinesArr[2 * i]/ 100*/, nLineTop );
+ Point aLineRight(nStartX + nRectWidth * 90 /100, nLineTop );
+ pVDev->DrawLine(aLineLeft, aLineRight);
+ }
+
+ }
+#ifdef DBG_UTIL
+ catch(Exception&)
+ {
+ static sal_Bool bAssert = sal_False;
+ if(!bAssert)
+ {
+ DBG_ERROR("exception in ::UserDraw");
+ bAssert = sal_True;
+ }
+ }
+#else
+ catch(Exception&)
+ {
+ }
+#endif
+ }
+ pDev->DrawOutDev( aRect.TopLeft(), aRectSize,
+ aOrgRect.TopLeft(), aRectSize,
+ *pVDev );
+ }
+
+ pDev->SetFont(aOldFont);
+ pDev->SetLineColor(aOldColor);
+}
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+SvxNumValueSet::SvxNumValueSet( Window* pParent, const ResId& rResId, sal_uInt16 nType ) :
+
+ ValueSet( pParent, rResId ),
+
+ aLineColor ( COL_LIGHTGRAY ),
+ nPageType ( nType ),
+ bHTMLMode ( sal_False ),
+ pVDev ( NULL )
+{
+ SetColCount( 4 );
+ SetLineCount( 2 );
+ SetStyle( GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER );
+ if(NUM_PAGETYPE_BULLET == nType)
+ {
+ for ( sal_uInt16 i = 0; i < 8; i++ )
+ {
+ InsertItem( i + 1, i );
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_BULLET_DESCRIPTIONS + i ) );
+ }
+ }
+}
+
+/*-----------------08.02.97 12.38-------------------
+
+--------------------------------------------------*/
+
+ SvxNumValueSet::~SvxNumValueSet()
+{
+ delete pVDev;
+}
+/* -----------------------------30.01.01 16:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxNumValueSet::SetNumberingSettings(
+ const Sequence<Sequence<PropertyValue> >& aNum,
+ Reference<XNumberingFormatter>& xFormat,
+ const Locale& rLocale )
+{
+ aNumSettings = aNum;
+ xFormatter = xFormat;
+ aLocale = rLocale;
+ if(aNum.getLength() > 8)
+ SetStyle( GetStyle()|WB_VSCROLL);
+ for ( sal_uInt16 i = 0; i < aNum.getLength(); i++ )
+ {
+ InsertItem( i + 1, i );
+ if( i < 8 )
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_SINGLENUM_DESCRIPTIONS + i ));
+ }
+}
+/* -----------------------------31.01.01 09:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxNumValueSet::SetOutlineNumberingSettings(
+ Sequence<Reference<XIndexAccess> >& rOutline,
+ Reference<XNumberingFormatter>& xFormat,
+ const Locale& rLocale)
+{
+ aOutlineSettings = rOutline;
+ xFormatter = xFormat;
+ aLocale = rLocale;
+ if(aOutlineSettings.getLength() > 8)
+ SetStyle( GetStyle() | WB_VSCROLL );
+ for ( sal_uInt16 i = 0; i < aOutlineSettings.getLength(); i++ )
+ {
+ InsertItem( i + 1, i );
+ if( i < 8 )
+ SetItemText( i + 1, SVX_RESSTR( RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + i ));
+ }
+}
+
+SvxBmpNumValueSet::SvxBmpNumValueSet( Window* pParent, const ResId& rResId/*, const List& rStrNames*/ ) :
+
+ SvxNumValueSet( pParent, rResId, NUM_PAGETYPE_BMP ),
+// rStrList ( rStrNames ),
+ bGrfNotFound( sal_False )
+
+{
+ GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
+ SetStyle( GetStyle() | WB_VSCROLL );
+ SetLineCount( 3 );
+ aFormatTimer.SetTimeout(300);
+ aFormatTimer.SetTimeoutHdl(LINK(this, SvxBmpNumValueSet, FormatHdl_Impl));
+}
+
+/*-----------------13.02.97 09.41-------------------
+
+--------------------------------------------------*/
+
+ SvxBmpNumValueSet::~SvxBmpNumValueSet()
+{
+ GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
+ aFormatTimer.Stop();
+}
+/*-----------------13.02.97 09.41-------------------
+
+--------------------------------------------------*/
+
+void SvxBmpNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ SvxNumValueSet::UserDraw(rUDEvt);
+
+ Rectangle aRect = rUDEvt.GetRect();
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ sal_uInt16 nItemId = rUDEvt.GetItemId();
+ Point aBLPos = aRect.TopLeft();
+
+ int nRectHeight = aRect.GetHeight();
+ Size aSize(nRectHeight/8, nRectHeight/8);
+
+ Graphic aGraphic;
+ if(!GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nItemId - 1,
+ &aGraphic, NULL))
+ {
+ bGrfNotFound = sal_True;
+ }
+ else
+ {
+ Point aPos(aBLPos.X() + 5, 0);
+ for( sal_uInt16 i = 0; i < 3; i++ )
+ {
+ sal_uInt16 nY = 11 + i * 33;
+ aPos.Y() = aBLPos.Y() + nRectHeight * nY / 100;
+ aGraphic.Draw( pDev, aPos, aSize );
+ }
+ }
+}
+
+/*-----------------14.02.97 07.34-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SvxBmpNumValueSet, FormatHdl_Impl, Timer*, EMPTYARG)
+{
+ // nur, wenn eine Grafik nicht da war, muss formatiert werden
+ if(bGrfNotFound)
+ {
+ bGrfNotFound = sal_False;
+ Format();
+ }
+ Invalidate();
+ return 0;
+}
diff --git a/svx/source/dialog/svxbmpnumvalueset.src b/svx/source/dialog/svxbmpnumvalueset.src
new file mode 100644
index 000000000000..aa01932e359b
--- /dev/null
+++ b/svx/source/dialog/svxbmpnumvalueset.src
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+
+String RID_SVXSTR_BULLET_DESCRIPTION_0
+{
+ Text [en-US] = "Solid small circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_1
+{
+ Text [en-US] = "Solid large circular bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_2
+{
+ Text [en-US] = "Solid diamond bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_3
+{
+ Text [en-US] = "Solid large square bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_4
+{
+ Text [en-US] = "Right pointing arrow bullets filled out";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_5
+{
+ Text [en-US] = "Right pointing arrow bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_6
+{
+ Text [en-US] = "Check mark bullets";
+};
+String RID_SVXSTR_BULLET_DESCRIPTION_7
+{
+ Text [en-US] = "Tick mark bullets";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Number 1) 2) 3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Number 1. 2. 3.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Number (1) (2) (3)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Uppercase Roman number I. II. III.";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase letter A) B) C)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Lowercase letter a) b) c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Lowercase letter (a) (b) (c)";
+};
+String RID_SVXSTR_SINGLENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Lowercase Roman number i. ii. iii.";
+};
+
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_0
+{
+ Text [en-US] = "Numeric, numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_1
+{
+ Text [en-US] = "Numeric, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_2
+{
+ Text [en-US] = "Numeric, lowercase letters, lowercase Roman, uppercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_3
+{
+ Text [en-US] = "Numeric";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_4
+{
+ Text [en-US] = "Uppercase Roman, uppercase letters, lowercase Roman, lowercase letters, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_5
+{
+ Text [en-US] = "Uppercase letters, uppercase Roman, lowercase letters, lowercase Roman, solid small circular bullet";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_6
+{
+ Text [en-US] = "Numeric with all sublevels";
+};
+String RID_SVXSTR_OUTLINENUM_DESCRIPTION_7
+{
+ Text [en-US] = "Right pointing bullet, right pointing arrow bullet, solid diamond bullet, solid small circular bullet";
+};
+
diff --git a/svx/source/dialog/svxdlg.cxx b/svx/source/dialog/svxdlg.cxx
new file mode 100644
index 000000000000..4ee81686e9c0
--- /dev/null
+++ b/svx/source/dialog/svxdlg.cxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/svxdlg.hxx>
+
+SvxAbstractDialogFactory* SvxAbstractDialogFactory::Create()
+{
+ return dynamic_cast< SvxAbstractDialogFactory* >( VclAbstractDialogFactory::Create() );
+}
+
+SvxAbstractDialogFactory::~SvxAbstractDialogFactory()
+{
+}
+
diff --git a/svx/source/dialog/svxgrahicitem.cxx b/svx/source/dialog/svxgrahicitem.cxx
new file mode 100644
index 000000000000..8a77fcfc6ef3
--- /dev/null
+++ b/svx/source/dialog/svxgrahicitem.cxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/svxgrahicitem.hxx"
+TYPEINIT1(SvxGraphicItem,SfxPoolItem);
+SvxGraphicItem::SvxGraphicItem( sal_uInt16 _nWhich, const Graphic& rGraphic )
+ : SfxPoolItem( _nWhich ), aGraphic( rGraphic )
+{
+
+}
+SvxGraphicItem::SvxGraphicItem( const SvxGraphicItem& rItem)
+ : SfxPoolItem( rItem.Which() ), aGraphic( rItem.aGraphic )
+{
+}
+
+int SvxGraphicItem::operator==( const SfxPoolItem& rItem) const
+{
+ return ((SvxGraphicItem&)rItem).aGraphic == aGraphic;
+}
+
+SfxPoolItem* SvxGraphicItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGraphicItem( *this );
+}
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
new file mode 100644
index 000000000000..4fbd1f3c288e
--- /dev/null
+++ b/svx/source/dialog/svxruler.cxx
@@ -0,0 +1,3976 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <string.h>
+#include <limits.h>
+#include <tools/shl.hxx>
+#include <vcl/image.hxx>
+#include <svl/eitem.hxx>
+#include <svl/rectitem.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svl/smplhint.hxx>
+
+
+
+
+
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+#include <svx/ruler.hxx>
+#include "rlrcitem.hxx"
+#include "svx/rulritem.hxx"
+#include <editeng/tstpitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include "editeng/protitem.hxx"
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef RULER_TAB_RTL
+#define RULER_TAB_RTL ((sal_uInt16)0x0010)
+#endif
+
+#include <comphelper/uieventslogger.hxx>
+
+namespace
+{
+ void lcl_logRulerUse(const ::rtl::OUString& sURL) //#i99729#
+ {
+ using namespace ::com::sun::star;
+ util::URL aTargetURL;
+ aTargetURL.Complete = sURL;
+ aTargetURL.Main = sURL;
+ if(::comphelper::UiEventsLogger::isEnabled()) //#i88653#
+ {
+ ::rtl::OUString sAppName;
+ uno::Sequence<beans::PropertyValue> source;
+ ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sAppName, ::rtl::OUString::createFromAscii("SfxRuler"));
+ ::comphelper::UiEventsLogger::logDispatch(aTargetURL, source);
+ }
+ }
+}
+
+
+
+// STATIC DATA -----------------------------------------------------------
+
+#define CTRL_ITEM_COUNT 14
+#define GAP 10
+#define OBJECT_BORDER_COUNT 4
+#define TAB_GAP 1
+#define INDENT_GAP 2
+#define INDENT_FIRST_LINE 4
+#define INDENT_LEFT_MARGIN 5
+#define INDENT_RIGHT_MARGIN 6
+#define INDENT_LEFT_BORDER 2
+#define INDENT_RIGHT_BORDER 3
+#define INDENT_COUNT 5 //without the first two old values
+
+#define PIXEL_H_ADJUST( l1, l2 ) PixelHAdjust(l1,l2)
+
+#ifdef DEBUGLIN
+
+inline long ToMM(Window *pWin, long lVal)
+{
+ return pWin->PixelToLogic(Size(lVal, 0), MapMode(MAP_MM)).Width();
+}
+
+void Debug_Impl(Window *pWin, SvxColumnItem& rColItem)
+{
+ String aTmp("Aktuell: ");
+ aTmp += rColItem.GetActColumn();
+ aTmp += " ColLeft: ";
+ aTmp += String(ToMM(pWin, rColItem.GetLeft()));
+ aTmp += " ColRight: ";
+ aTmp += String(ToMM(pWin, rColItem.GetRight()));
+ for(sal_uInt16 i = 0; i < rColItem.Count(); ++i) {
+ aTmp += " Start: ";
+ aTmp += String(ToMM(pWin, rColItem[i].nStart));
+ aTmp += " End: ";
+ aTmp += String(ToMM(pWin, rColItem[i].nEnd));
+ }
+
+ InfoBox(0, aTmp).Execute();
+}
+
+void Debug_Impl(Window *pWin, const SvxLongLRSpaceItem& rLRSpace)
+{
+ String aTmp("Left: ");
+ aTmp += pWin->PixelToLogic(Size(rLRSpace.GetLeft(), 0), MapMode(MAP_MM)).Width();
+ aTmp += " Right: ";
+ aTmp +=pWin->PixelToLogic(Size(rLRSpace.GetRight(), 0), MapMode(MAP_MM)).Width();
+ InfoBox(0, aTmp).Execute();
+}
+
+void Debug_Impl(Window *pWin, const SvxLongULSpaceItem& rULSpace)
+{
+ String aTmp("Upper: ");
+ aTmp += pWin->PixelToLogic(Size(rULSpace.GetUpper(), 0), MapMode(MAP_MM)).Width();
+ aTmp += " Lower: ";
+ aTmp += pWin->PixelToLogic(Size(rULSpace.GetLower(), 0), MapMode(MAP_MM)).Width();
+
+ InfoBox(0, aTmp).Execute();
+}
+
+void DebugTabStops_Impl(const SvxTabStopItem& rTabs)
+{
+ String aTmp("Tabs: ");
+
+ // Def Tabs loeschen
+ for(sal_uInt16 i = 0; i < rTabs.Count(); ++i)
+ {
+ aTmp += String(rTabs[i].GetTabPos() / 56);
+ aTmp += " : ";
+ }
+ InfoBox(0, aTmp).Execute();
+}
+
+void DebugParaMargin_Impl(const SvxLRSpaceItem& rLRSpace)
+{
+ String aTmp("ParaLeft: ");
+ aTmp += rLRSpace.GetTxtLeft() / 56;
+ aTmp += " ParaRight: ";
+ aTmp += rLRSpace.GetRight() / 56;
+ aTmp += " FLI: ";
+ aTmp += rLRSpace.GetTxtFirstLineOfst() / 56;
+ InfoBox(0, aTmp).Execute();
+}
+
+#endif // DEBUGLIN
+#ifdef DEBUG_RULER
+#include <vcl/svapp.hxx>
+#include <vcl/lstbox.hxx>
+class RulerDebugWindow : public Window
+{
+ ListBox aBox;
+public:
+ RulerDebugWindow(Window* pParent) :
+ Window(pParent, WB_BORDER|WB_SIZEMOVE|WB_DIALOGCONTROL|WB_CLIPCHILDREN|WB_SYSTEMWINDOW),
+ aBox(this, WB_BORDER)
+ {
+ Size aOutput(200, 400);
+ SetOutputSizePixel(aOutput);
+ aBox.SetSizePixel(aOutput);
+ aBox.Show();
+ Show();
+ Size aParentSize(pParent->GetOutputSizePixel());
+ Size aOwnSize(GetSizePixel());
+ aParentSize.Width() -= aOwnSize.Width();
+ aParentSize.Height() -= aOwnSize.Height();
+ SetPosPixel(Point(aParentSize.Width(), aParentSize.Height()));
+ }
+ ~RulerDebugWindow();
+
+ ListBox& GetLBox() {return aBox;}
+ static void AddDebugText(const sal_Char* pDescription, const String& rText );
+};
+static RulerDebugWindow* pDebugWindow = 0;
+
+RulerDebugWindow::~RulerDebugWindow()
+{
+ pDebugWindow = 0;
+}
+void RulerDebugWindow::AddDebugText(const sal_Char* pDescription, const String& rText )
+{
+ if(!pDebugWindow)
+ {
+ Window* pParent = Application::GetFocusWindow();
+ while(pParent->GetParent())
+ pParent = pParent->GetParent();
+ pDebugWindow = new RulerDebugWindow(pParent);
+ }
+ String sContent(String::CreateFromAscii(pDescription));
+ sContent += rText;
+ sal_uInt16 nPos = pDebugWindow->GetLBox().InsertEntry(sContent);
+ pDebugWindow->GetLBox().SelectEntryPos(nPos);
+ pDebugWindow->GrabFocus();
+}
+
+#define ADD_DEBUG_TEXT(cDescription, sValue) \
+ RulerDebugWindow::AddDebugText(cDescription, sValue);
+
+#define REMOVE_DEBUG_WINDOW \
+ delete pDebugWindow; \
+ pDebugWindow = 0;
+
+#else
+#define ADD_DEBUG_TEXT(cDescription, sValue)
+#define REMOVE_DEBUG_WINDOW
+#endif
+
+struct SvxRuler_Impl {
+ sal_uInt16 *pPercBuf;
+ sal_uInt16 *pBlockBuf;
+ sal_uInt16 nPercSize;
+ long nTotalDist;
+ long lOldWinPos;
+ long lMaxLeftLogic;
+ long lMaxRightLogic;
+ long lLastLMargin;
+ long lLastRMargin;
+ SvxProtectItem aProtectItem;
+ SfxBoolItem* pTextRTLItem;
+ sal_uInt16 nControlerItems;
+ sal_uInt16 nIdx;
+ sal_uInt16 nColLeftPix, nColRightPix; // Pixelwerte fuer linken / rechten Rand
+ // bei Spalten; gepuffert, um Umrechenfehler
+ // zu vermeiden.
+ // Muesste vielleicht fuer weitere Werte
+ // aufgebohrt werden
+ sal_Bool bIsTableRows : 1; // pColumnItem contains table rows instead of columns
+ //#i24363# tab stops relative to indent
+ sal_Bool bIsTabsRelativeToIndent : 1; // Tab stops relative to paragraph indent?
+ SvxRuler_Impl() :
+ pPercBuf(0), pBlockBuf(0),
+ nPercSize(0), nTotalDist(0),
+ lOldWinPos(0),
+ lMaxLeftLogic(0), lMaxRightLogic(0),
+ lLastLMargin(0), lLastRMargin(0),
+ aProtectItem(SID_RULER_PROTECT),
+ pTextRTLItem(0), nControlerItems(0),
+ nIdx(0),
+ nColLeftPix(0), nColRightPix(0),
+
+ bIsTableRows(sal_False),
+ bIsTabsRelativeToIndent(sal_True)
+ {
+ }
+ ~SvxRuler_Impl()
+ {
+ nPercSize = 0; nTotalDist = 0;
+ delete[] pPercBuf; delete[] pBlockBuf; pPercBuf = 0;
+ delete pTextRTLItem;
+ }
+ void SetPercSize(sal_uInt16 nSize);
+
+};
+
+
+
+void SvxRuler_Impl::SetPercSize(sal_uInt16 nSize)
+{
+ if(nSize > nPercSize)
+ {
+ delete[] pPercBuf;
+ delete[] pBlockBuf;
+ pPercBuf = new sal_uInt16[nPercSize = nSize];
+ pBlockBuf = new sal_uInt16[nPercSize = nSize];
+ }
+ size_t nSize2 = sizeof(sal_uInt16) * nPercSize;
+ memset(pPercBuf, 0, nSize2);
+ memset(pBlockBuf, 0, nSize2);
+}
+
+
+// Konstruktor des Lineals
+
+// SID_ATTR_ULSPACE, SID_ATTR_LRSPACE
+// erwartet als Parameter SvxULSpaceItem f"ur Seitenr"ander
+// (entweder links/rechts oder oben/unten)
+// Lineal: SetMargin1, SetMargin2
+
+// SID_RULER_PAGE_POS
+// erwartet als Parameter Anfangswert der Seite sowie Seitenbreite
+// Lineal: SetPagePos
+
+// SID_ATTR_TABSTOP
+// erwartet: SvxTabStopItem
+// Lineal: SetTabs
+
+// SID_ATTR_PARA_LRSPACE
+// linker, rechter Absatzrand bei H-Lineal
+// Lineal: SetIndents
+
+// SID_RULER_BORDERS
+// Tabellenraender, Spalten
+// erwartet: so etwas wie SwTabCols
+// Lineal: SetBorders
+
+
+SvxRuler::SvxRuler
+(
+ Window* pParent, // StarView Parent
+ Window* pWin, // Ausgabefenster; wird fuer Umrechnung logische
+ // Einheiten <-> Pixel verwendet
+ sal_uInt16 flags, // Anzeige Flags, siehe ruler.hxx
+ SfxBindings &rBindings, // zugeordnete Bindings
+ WinBits nWinStyle // StarView WinBits
+)
+: Ruler(pParent, nWinStyle),
+ pCtrlItem(new SvxRulerItem *[CTRL_ITEM_COUNT]),
+ pLRSpaceItem(0),
+ pMinMaxItem(0),
+ pULSpaceItem(0),
+ pTabStopItem(0),
+ pParaItem(0),
+ pParaBorderItem(0),
+ pPagePosItem(0),
+ pColumnItem(0),
+ pObjectItem(0),
+ pEditWin(pWin),
+ pRuler_Imp(new SvxRuler_Impl),
+ bAppSetNullOffset(sal_False), //Wird der 0-Offset des Lineals
+ //durch die appl. gesetzt?
+ lLogicNullOffset(0),
+ lAppNullOffset(LONG_MAX),
+ lMinFrame(5),
+ lInitialDragPos(0),
+ nFlags(flags),
+ nDragType(NONE),
+ nDefTabType(RULER_TAB_LEFT),
+ nTabCount(0),
+ nTabBufSize(0),
+ lDefTabDist(50),
+ lTabPos(-1),
+ pTabs(0),
+ pIndents(0),
+ pBorders(new RulerBorder[1]), //wg 1 Spaltiger Tabellen
+ nBorderCount(0),
+ pObjectBorders(0),
+ pBindings(&rBindings),
+ nDragOffset(0),
+ nMaxLeft(0),
+ nMaxRight(0),
+ bValid(sal_False),
+ bListening(sal_False),
+ bActive(sal_True)
+
+/*
+ [Beschreibung]
+
+ ctor;
+ Datenpuffer initialisieren; ControllerItems werden erzeugt
+
+*/
+{
+ memset(pCtrlItem, 0, sizeof(SvxRulerItem *) * CTRL_ITEM_COUNT);
+
+ rBindings.EnterRegistrations();
+
+ // Unterstuetzte Items anlegen
+ sal_uInt16 i = 0;
+ // Seitenraender
+
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_LR_MIN_MAX, *this, rBindings);
+ if((nWinStyle & WB_VSCROLL) == WB_VSCROLL)
+ {
+ bHorz = sal_False;
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_LONG_ULSPACE, *this, rBindings);
+ }
+ else
+ {
+ bHorz = sal_True;
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_LONG_LRSPACE, *this, rBindings);
+ }
+
+ // Seitenposition
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_PAGE_POS, *this, rBindings);
+
+ if((nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS)
+ {
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pCtrlItem[i++] = new SvxRulerItem(nTabStopId, *this, rBindings);
+ SetExtraType(RULER_EXTRA_TAB, nDefTabType);
+ }
+
+
+ if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS |SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL)))
+ {
+ if(bHorz)
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_PARA_LRSPACE, *this, rBindings);
+ else
+ pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_PARA_LRSPACE_VERTICAL, *this, rBindings);
+ pIndents = new RulerIndent[5+INDENT_GAP];
+ memset(pIndents, 0, sizeof(RulerIndent)*(3+INDENT_GAP));
+ pIndents[0].nStyle = RULER_STYLE_DONTKNOW;
+ pIndents[1].nStyle = RULER_STYLE_DONTKNOW;
+ pIndents[INDENT_FIRST_LINE].nStyle = RULER_INDENT_TOP;
+ pIndents[INDENT_LEFT_MARGIN].nStyle = RULER_INDENT_BOTTOM;
+ pIndents[INDENT_RIGHT_MARGIN].nStyle = RULER_INDENT_BOTTOM;
+ pIndents[INDENT_LEFT_BORDER].nStyle = RULER_INDENT_BORDER;
+ pIndents[INDENT_RIGHT_BORDER].nStyle = RULER_INDENT_BORDER;
+ for(sal_uInt16 nIn = 0; nIn < 7; nIn++)
+ pIndents[nIn].nPos = 0;
+ }
+
+ if((nFlags & SVXRULER_SUPPORT_BORDERS) == SVXRULER_SUPPORT_BORDERS)
+ {
+ pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL, *this, rBindings);
+ pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL, *this, rBindings);
+ }
+
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_TEXT_RIGHT_TO_LEFT, *this, rBindings);
+
+ if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT)
+ {
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_OBJECT, *this, rBindings );
+ pObjectBorders = new RulerBorder[OBJECT_BORDER_COUNT];
+ size_t nSize = sizeof( RulerBorder ) * OBJECT_BORDER_COUNT;
+ memset(pObjectBorders, 0, nSize);
+ for(sal_uInt16 nBorder = 0; nBorder < OBJECT_BORDER_COUNT; ++nBorder)
+ {
+ pObjectBorders[nBorder].nPos = 0;
+ pObjectBorders[nBorder].nWidth = 0;
+ pObjectBorders[nBorder].nStyle = RULER_BORDER_MOVEABLE;
+ }
+ }
+
+ pCtrlItem[i++] = new SvxRulerItem( SID_RULER_PROTECT, *this, rBindings );
+ pCtrlItem[i++] = new SvxRulerItem(SID_RULER_BORDER_DISTANCE, *this, rBindings);
+ pRuler_Imp->nControlerItems=i;
+
+ if((nFlags & SVXRULER_SUPPORT_SET_NULLOFFSET) ==
+ SVXRULER_SUPPORT_SET_NULLOFFSET)
+ SetExtraType(RULER_EXTRA_NULLOFFSET, 0);
+
+ rBindings.LeaveRegistrations();
+}
+
+
+__EXPORT SvxRuler::~SvxRuler()
+/*
+ [Beschreibung]
+
+ Destruktor Lineal
+ Freigabe interner Puffer
+
+
+*/
+{
+ REMOVE_DEBUG_WINDOW
+ if(bListening)
+ EndListening(*pBindings);
+
+ pBindings->EnterRegistrations();
+
+ for(sal_uInt16 i = 0; i < CTRL_ITEM_COUNT && pCtrlItem[i]; ++i)
+ delete pCtrlItem[i];
+ delete[] pCtrlItem;
+
+ delete pLRSpaceItem;
+ delete pMinMaxItem;
+ delete pULSpaceItem;
+ delete pTabStopItem;
+ delete pParaItem;
+ delete pParaBorderItem;
+ delete pPagePosItem;
+ delete pColumnItem;
+ delete pObjectItem;
+ delete[] pIndents;
+ delete[] pBorders;
+ delete[] pObjectBorders;
+ delete[] pTabs;
+ delete pRuler_Imp;
+
+ pBindings->LeaveRegistrations();
+}
+
+/*
+
+ [Beschreibung]
+
+ Interne Umrechenroutinen
+
+*/
+
+long SvxRuler::ConvertHPosPixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(nVal, 0)).Width();
+}
+
+long SvxRuler::ConvertVPosPixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(0, nVal)).Height();
+}
+
+long SvxRuler::ConvertHSizePixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(nVal, 0)).Width();
+}
+
+long SvxRuler::ConvertVSizePixel(long nVal) const
+{
+ return pEditWin->LogicToPixel(Size(0, nVal)).Height();
+}
+
+long SvxRuler::ConvertPosPixel(long nVal) const
+{
+ return bHorz ? ConvertHPosPixel(nVal): ConvertVPosPixel(nVal);
+}
+
+long SvxRuler::ConvertSizePixel(long nVal) const
+{
+ return bHorz? ConvertHSizePixel(nVal): ConvertVSizePixel(nVal);
+}
+
+
+inline long SvxRuler::ConvertHPosLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(nVal, 0)).Width();
+}
+
+inline long SvxRuler::ConvertVPosLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(0, nVal)).Height();
+}
+
+inline long SvxRuler::ConvertHSizeLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(nVal, 0)).Width();
+}
+
+inline long SvxRuler::ConvertVSizeLogic(long nVal) const
+{
+ return pEditWin->PixelToLogic(Size(0, nVal)).Height();
+}
+
+inline long SvxRuler::ConvertPosLogic(long nVal) const
+{
+ return bHorz? ConvertHPosLogic(nVal): ConvertVPosLogic(nVal);
+}
+
+inline long SvxRuler::ConvertSizeLogic(long nVal) const
+{
+ return bHorz? ConvertHSizeLogic(nVal): ConvertVSizeLogic(nVal);
+}
+
+long SvxRuler::PixelHAdjust(long nVal, long nValOld) const
+{
+ if(ConvertHSizePixel(nVal)!=ConvertHSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+long SvxRuler::PixelVAdjust(long nVal, long nValOld) const
+{
+ if(ConvertVSizePixel(nVal)!=ConvertVSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+long SvxRuler::PixelAdjust(long nVal, long nValOld) const
+{
+ if(ConvertSizePixel(nVal)!=ConvertSizePixel(nValOld))
+ return nVal;
+ else
+ return nValOld;
+}
+
+
+inline sal_uInt16 SvxRuler::GetObjectBordersOff(sal_uInt16 nIdx) const
+{
+ return bHorz? nIdx: nIdx + 2;
+}
+
+
+
+void SvxRuler::UpdateFrame()
+
+/*
+ [Beschreibung]
+
+ Linken, oberen Rand aktualisieren
+ Items werden in die Darstellung des Lineals uebersetzt.
+
+*/
+
+{
+ const sal_uInt16 nMarginStyle =
+ ( pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected() ) ?
+ 0 : RULER_MARGIN_SIZEABLE;
+
+ if(pLRSpaceItem && pPagePosItem)
+ {
+ // wenn keine Initialisierung durch App Defaultverhalten
+ const long nOld = lLogicNullOffset;
+ lLogicNullOffset = pColumnItem?
+ pColumnItem->GetLeft(): pLRSpaceItem->GetLeft();
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - nOld;
+ if(!bAppSetNullOffset || lAppNullOffset == LONG_MAX)
+ {
+ Ruler::SetNullOffset(ConvertHPosPixel(lLogicNullOffset));
+ SetMargin1( 0, nMarginStyle );
+ lAppNullOffset = 0;
+ }
+ else
+ SetMargin1( ConvertHPosPixel( lAppNullOffset ), nMarginStyle );
+ long lRight = 0;
+ // bei Tabelle rechten Rand der Tabelle auswerten
+ if(pColumnItem && pColumnItem->IsTable())
+ lRight = pColumnItem->GetRight();
+ else
+ lRight = pLRSpaceItem->GetRight();
+
+ sal_uIntPtr aWidth=
+ ConvertHPosPixel(pPagePosItem->GetWidth() - lRight -
+ lLogicNullOffset + lAppNullOffset);
+ SetMargin2( aWidth, nMarginStyle );
+ }
+ else
+ if(pULSpaceItem && pPagePosItem)
+ {
+ // Nullpunkt aus oberem Rand des umgebenden Rahmens
+ const long nOld = lLogicNullOffset;
+ lLogicNullOffset = pColumnItem?
+ pColumnItem->GetLeft(): pULSpaceItem->GetUpper();
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - nOld;
+ if(!bAppSetNullOffset || lAppNullOffset == LONG_MAX) {
+ Ruler::SetNullOffset(ConvertVPosPixel(lLogicNullOffset));
+ lAppNullOffset = 0;
+ SetMargin1( 0, nMarginStyle );
+ }
+ else
+ SetMargin1( ConvertVPosPixel( lAppNullOffset ),nMarginStyle );
+
+ long lLower = pColumnItem ?
+ pColumnItem->GetRight() : pULSpaceItem->GetLower();
+
+ SetMargin2(ConvertVPosPixel(pPagePosItem->GetHeight() - lLower -
+ lLogicNullOffset + lAppNullOffset),
+ nMarginStyle );
+ }
+ else
+ {
+ // schaltet die Anzeige aus
+ SetMargin1();
+ SetMargin2();
+ }
+ if(pColumnItem)
+ {
+ pRuler_Imp->nColLeftPix = (sal_uInt16) ConvertSizePixel(pColumnItem->GetLeft());
+ pRuler_Imp->nColRightPix = (sal_uInt16) ConvertSizePixel(pColumnItem->GetRight());
+ }
+
+}
+
+void SvxRuler::MouseMove( const MouseEvent& rMEvt )
+{
+ if( bActive )
+ {
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Update( bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL);
+ pBindings->Update( bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL);
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Update( SID_RULER_PROTECT );
+ }
+ Ruler::MouseMove( rMEvt );
+}
+void SvxRuler::StartListening_Impl()
+{
+ if(!bListening)
+ {
+ bValid = sal_False;
+ StartListening(*pBindings);
+ bListening = sal_True;
+ }
+}
+
+void SvxRuler::UpdateFrame
+(
+ const SvxLongLRSpaceItem *pItem // neuer Wert LRSpace
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer LRSpace merken; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pLRSpaceItem; pLRSpaceItem = 0;
+ if(pItem)
+ pLRSpaceItem = new SvxLongLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdateFrameMinMax
+(
+ const SfxRectangleItem *pItem // Werte fuer MinMax
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer MinMax setzen; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pMinMaxItem; pMinMaxItem = 0;
+ if(pItem)
+ pMinMaxItem = new SfxRectangleItem(*pItem);
+ }
+}
+
+
+void SvxRuler::UpdateFrame
+(
+ const SvxLongULSpaceItem *pItem // neuer Wert
+)
+
+/*
+ [Beschreibung]
+
+ Rechten / unteren Rand aktualisieren
+
+*/
+
+
+{
+ if(bActive && !bHorz)
+ {
+ delete pULSpaceItem; pULSpaceItem = 0;
+ if(pItem)
+ pULSpaceItem = new SvxLongULSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+void SvxRuler::Update( const SvxProtectItem* pItem )
+{
+ if( pItem ) pRuler_Imp->aProtectItem = *pItem;
+}
+/* -----------------------------22.08.2002 13:10------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SvxRuler::UpdateTextRTL(const SfxBoolItem* pItem)
+{
+ if(bActive && bHorz)
+ {
+ delete pRuler_Imp->pTextRTLItem; pRuler_Imp->pTextRTLItem = 0;
+ if(pItem)
+ pRuler_Imp->pTextRTLItem = new SfxBoolItem(*pItem);
+ SetTextRTL(pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue());
+ StartListening_Impl();
+ }
+}
+
+void SvxRuler::Update
+(
+ const SvxColumnItem *pItem, // neuer Wert
+ sal_uInt16 nSID //Slot Id to identify NULL items
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Spaltendarstellung setzen
+
+*/
+
+{
+ if(bActive)
+ {
+ if(pItem)
+ {
+ delete pColumnItem; pColumnItem = 0;
+ pRuler_Imp->bIsTableRows = (pItem->Which() == SID_RULER_ROWS || pItem->Which() == SID_RULER_ROWS_VERTICAL);
+ pColumnItem = new SvxColumnItem(*pItem);
+ if(!bHorz && !pRuler_Imp->bIsTableRows)
+ pColumnItem->SetWhich(SID_RULER_BORDERS_VERTICAL);
+ }
+ else if(pColumnItem && pColumnItem->Which() == nSID)
+ //there are two groups of column items table/frame columns and table rows
+ //both can occur in vertical or horizontal mode
+ //the horizontal ruler handles the SID_RULER_BORDERS and SID_RULER_ROWS_VERTICAL
+ //and the vertical handles SID_RULER_BORDERS_VERTICAL and SID_RULER_ROWS
+ //if pColumnItem is already set with one of the ids then a NULL pItem argument
+ //must not delete it
+ {
+ delete pColumnItem; pColumnItem = 0;
+ pRuler_Imp->bIsTableRows = sal_False;
+ }
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdateColumns()
+/*
+ [Beschreibung]
+
+ Anzeige der Spaltendarstellung aktualisieren
+
+*/
+{
+ if(pColumnItem && pColumnItem->Count() > 1)
+ {
+ if( nBorderCount < pColumnItem->Count())
+ {
+ delete[] pBorders;
+ nBorderCount = pColumnItem->Count();
+ pBorders = new RulerBorder[nBorderCount];
+ }
+ sal_uInt16 _nFlags = RULER_BORDER_VARIABLE;
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ if( !bProtectColumns )
+ _nFlags |= RULER_BORDER_MOVEABLE;
+ if( pColumnItem->IsTable() )
+ _nFlags |= RULER_BORDER_TABLE;
+ else
+ if ( !bProtectColumns )
+ _nFlags |= RULER_BORDER_SIZEABLE;
+
+ sal_uInt16 nBorders = pColumnItem->Count();
+ if(!pRuler_Imp->bIsTableRows)
+ --nBorders;
+ for(sal_uInt16 i = 0; i < nBorders; ++i)
+ {
+ pBorders[i].nStyle = _nFlags;
+ if(!(*pColumnItem)[i].bVisible)
+ pBorders[i].nStyle |= RULER_STYLE_INVISIBLE;
+ pBorders[i].nPos =
+ ConvertPosPixel((*pColumnItem)[i].nEnd + lAppNullOffset);
+ if(pColumnItem->Count() == i + 1)
+ {
+ //with table rows the end of the table is contained in the
+ //column item but it has no width!
+ pBorders[i].nWidth = 0;
+ }
+ else
+ {
+ pBorders[i].nWidth =
+ ConvertSizePixel((*pColumnItem)[i+1].nStart -
+ (*pColumnItem)[i].nEnd);
+ }
+ pBorders[i].nMinPos =
+ ConvertPosPixel((*pColumnItem)[i].nEndMin + lAppNullOffset);
+ pBorders[i].nMaxPos =
+ ConvertPosPixel((*pColumnItem)[i].nEndMax + lAppNullOffset);
+ }
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ }
+ else
+ {
+ SetBorders();
+ }
+}
+
+
+void SvxRuler::UpdateObject()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Objektdarstellung aktualisieren
+
+*/
+
+{
+ if(pObjectItem)
+ {
+ DBG_ASSERT(pObjectBorders, "kein Buffer");
+ // !! zum Seitenrand
+ long nMargin = pLRSpaceItem? pLRSpaceItem->GetLeft(): 0;
+ pObjectBorders[0].nPos =
+ ConvertPosPixel(pObjectItem->GetStartX() -
+ nMargin + lAppNullOffset);
+ pObjectBorders[1].nPos =
+ ConvertPosPixel(pObjectItem->GetEndX() - nMargin + lAppNullOffset);
+ nMargin = pULSpaceItem? pULSpaceItem->GetUpper(): 0;
+ pObjectBorders[2].nPos =
+ ConvertPosPixel(pObjectItem->GetStartY() -
+ nMargin + lAppNullOffset);
+ pObjectBorders[3].nPos =
+ ConvertPosPixel(pObjectItem->GetEndY() - nMargin + lAppNullOffset);
+
+ const sal_uInt16 nOff = GetObjectBordersOff(0);
+ SetBorders(2, pObjectBorders + nOff);
+ }
+ else
+ {
+ SetBorders();
+ }
+}
+
+
+void SvxRuler::UpdatePara()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Absatzeinzuege aktualisieren:
+ Linken Rand, Erstzeileneinzug, rechten Rand Absatz aktualisieren
+ pIndents[0] = Buffer fuer alten Einzug
+ pIndents[1] = Buffer fuer alten Einzug
+ pIndents[INDENT_FIRST_LINE] = Erstzeileneinzug
+ pIndents[3] = linker Rand
+ pIndents[4] = rechter Rand
+ pIndents[5] = left border distance
+ pIndents[6] = right border distance
+
+*/
+
+{
+ // Abhaengigkeit zu PagePosItem
+ if(pParaItem && pPagePosItem && !pObjectItem)
+ {
+ sal_Bool bRTLText = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ // Erstzeileneinzug, ist negativ zum linken Absatzrand
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+ if(bRTLText)
+ pIndents[INDENT_FIRST_LINE].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetTxtLeft() -
+ pParaItem->GetTxtFirstLineOfst() + lAppNullOffset );
+ else
+ pIndents[INDENT_FIRST_LINE].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetTxtLeft() +
+ pParaItem->GetTxtFirstLineOfst() +
+ lAppNullOffset);
+ if( pParaItem->IsAutoFirst() )
+ pIndents[INDENT_FIRST_LINE].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pIndents[INDENT_FIRST_LINE].nStyle &= ~RULER_STYLE_INVISIBLE;
+
+ if(bRTLText)
+ {
+ // left margin
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetTxtLeft() + lAppNullOffset);
+ // right margin
+ pIndents[INDENT_RIGHT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetRight() + lAppNullOffset);
+ }
+ else
+ {
+ // linker Rand
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nLeftFrameMargin +
+ pParaItem->GetTxtLeft() + lAppNullOffset);
+ // rechter Rand, immer negativ zum rechten Rand des umgebenden Frames
+ pIndents[INDENT_RIGHT_MARGIN].nPos =
+ ConvertHPosPixel(
+ nRightFrameMargin -
+ pParaItem->GetRight() + lAppNullOffset);
+ }
+ if(pParaBorderItem)
+ {
+ pIndents[INDENT_LEFT_BORDER].nPos =
+ ConvertHPosPixel( nLeftFrameMargin + lAppNullOffset);
+ pIndents[INDENT_RIGHT_BORDER].nPos =
+ ConvertHPosPixel(nRightFrameMargin - lAppNullOffset);
+ pIndents[INDENT_LEFT_BORDER].nStyle = pIndents[INDENT_RIGHT_BORDER].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ else
+ pIndents[INDENT_LEFT_BORDER].nStyle = pIndents[INDENT_RIGHT_BORDER].nStyle |= RULER_STYLE_INVISIBLE;
+
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ else
+ {
+ if(pIndents)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos =
+ pIndents[INDENT_LEFT_MARGIN].nPos =
+ pIndents[INDENT_RIGHT_MARGIN].nPos = 0;
+ }
+ SetIndents(); // ausschalten
+ }
+}
+
+
+void SvxRuler::UpdatePara
+(
+ const SvxLRSpaceItem *pItem // neuer Wert Absatzeinzuege
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert Absatzeinzuege merken
+*/
+
+{
+ if(bActive)
+ {
+ delete pParaItem; pParaItem = 0;
+ if(pItem)
+ pParaItem = new SvxLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+void SvxRuler::UpdateParaBorder(const SvxLRSpaceItem * pItem )
+/*
+ [Description]
+ Border distance
+*/
+
+{
+ if(bActive)
+ {
+ delete pParaBorderItem; pParaBorderItem = 0;
+ if(pItem)
+ pParaBorderItem = new SvxLRSpaceItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::UpdatePage()
+
+/*
+ [Beschreibung]
+
+ Anzeige von Postion und Breite der Seite aktualisieren
+
+*/
+
+{
+ if(pPagePosItem)
+ {
+ // alle Objekte werden automatisch angepasst
+ if(bHorz)
+ SetPagePos(
+ pEditWin->LogicToPixel(pPagePosItem->GetPos()).X(),
+ pEditWin->LogicToPixel(Size(pPagePosItem->GetWidth(),0)).
+ Width());
+ else
+ SetPagePos(
+ pEditWin->LogicToPixel(pPagePosItem->GetPos()).Y(),
+ pEditWin->LogicToPixel(Size(0, pPagePosItem->GetHeight())).
+ Height());
+ if(bAppSetNullOffset)
+ SetNullOffset(ConvertSizePixel(-lAppNullOffset + lLogicNullOffset));
+ }
+ else
+ SetPagePos();
+
+ long lPos = 0;
+ Point aOwnPos = GetPosPixel();
+ Point aEdtWinPos = pEditWin->GetPosPixel();
+ if( Application::GetSettings().GetLayoutRTL() && bHorz )
+ {
+ //#i73321# in RTL the window and the ruler is not mirrored but the
+ // influence of the vertical ruler is inverted
+ Size aOwnSize = GetSizePixel();
+ Size aEdtWinSize = pEditWin->GetSizePixel();
+ lPos = aOwnSize.Width() - aEdtWinSize.Width();
+ lPos -= (aEdtWinPos - aOwnPos).X();
+ }
+ else
+ {
+ Point aPos(aEdtWinPos - aOwnPos);
+ lPos= bHorz ? aPos.X() : aPos.Y();
+ }
+
+// Leider bekommen wir den Offset des Editfensters zum Lineal nie
+// per Statusmeldung. Also setzen wir ihn selbst, wenn noetig.
+
+ if(lPos!=pRuler_Imp->lOldWinPos)
+ {
+ pRuler_Imp->lOldWinPos=lPos;
+ SetWinPos(lPos);
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxPagePosSizeItem *pItem // neuer Wert Seitenattribute
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert Seitenattribute merken
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pPagePosItem; pPagePosItem = 0;
+ if(pItem)
+ pPagePosItem = new SvxPagePosSizeItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+//
+
+void SvxRuler::SetDefTabDist
+(
+ long l // Neuer Abstand fuer DefaultTabs in App-Metrik
+)
+
+/*
+ [Beschreibung]
+
+ Neuer Abstand fuer DefaultTabs wird gesetzt
+
+*/
+
+{
+
+ lDefTabDist = l;
+ UpdateTabs();
+}
+
+
+long SvxRuler::GetDefTabDist() const
+
+/*
+ [Beschreibung]
+
+ Wert fuer DefaultTabs erfragen (wird in App.-Methik geliefert)
+
+*/
+
+{
+ return lDefTabDist;
+}
+
+
+sal_uInt16 ToSvTab_Impl(SvxTabAdjust eAdj)
+
+/*
+ [Beschreibung]
+
+ Interne Konvertierungsroutinen zwischen SV-Tab.-Enum und Svx
+
+*/
+
+{
+ switch(eAdj) {
+ case SVX_TAB_ADJUST_LEFT: return RULER_TAB_LEFT;
+ case SVX_TAB_ADJUST_RIGHT: return RULER_TAB_RIGHT;
+ case SVX_TAB_ADJUST_DECIMAL: return RULER_TAB_DECIMAL;
+ case SVX_TAB_ADJUST_CENTER: return RULER_TAB_CENTER;
+ case SVX_TAB_ADJUST_DEFAULT: return RULER_TAB_DEFAULT;
+ default: ;//prevent warning
+ }
+ return 0;
+}
+
+
+SvxTabAdjust ToAttrTab_Impl(sal_uInt16 eAdj)
+{
+ switch(eAdj) {
+ case RULER_TAB_LEFT: return SVX_TAB_ADJUST_LEFT ;
+ case RULER_TAB_RIGHT: return SVX_TAB_ADJUST_RIGHT ;
+ case RULER_TAB_DECIMAL: return SVX_TAB_ADJUST_DECIMAL ;
+ case RULER_TAB_CENTER: return SVX_TAB_ADJUST_CENTER ;
+ case RULER_TAB_DEFAULT: return SVX_TAB_ADJUST_DEFAULT ;
+ }
+ return SVX_TAB_ADJUST_LEFT;
+}
+
+
+void SvxRuler::UpdateTabs()
+
+/*
+ [Beschreibung]
+
+ Anzeige der Tabulatoren
+
+*/
+
+{
+ if(IsDrag())
+ return;
+ if(pPagePosItem && pParaItem && pTabStopItem && !pObjectItem)
+ {
+ // Puffer fuer DefaultTabStop
+ // Abstand letzter Tab <-> Rechter Absatzrand / DefaultTabDist
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+
+ //#i24363# tab stops relative to indent
+ const long nParaItemTxtLeft = pParaItem->GetTxtLeft();
+
+ const long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft;
+
+ const long lLastTab =
+ pTabStopItem->Count()?
+ ConvertHPosPixel((*pTabStopItem)[pTabStopItem->Count()-1].GetTabPos()): 0;
+ const long lPosPixel =
+ ConvertHPosPixel(lParaIndent) + lLastTab;
+ const long lRightIndent =
+ ConvertHPosPixel(nRightFrameMargin - pParaItem->GetRight());
+ long nDefTabDist = ConvertHPosPixel(lDefTabDist);
+ if( !nDefTabDist )
+ nDefTabDist = 1;
+ const sal_uInt16 nDefTabBuf = lPosPixel > lRightIndent ||
+ lLastTab > lRightIndent
+ ? 0
+ : (sal_uInt16)( (lRightIndent - lPosPixel) / nDefTabDist );
+
+ if(pTabStopItem->Count() + TAB_GAP + nDefTabBuf > nTabBufSize)
+ {
+ delete[] pTabs;
+ // 10 (GAP) auf Vorrat
+ nTabBufSize = pTabStopItem->Count() + TAB_GAP + nDefTabBuf + GAP;
+ pTabs = new RulerTab[nTabBufSize];
+ }
+
+ nTabCount = 0;
+ sal_uInt16 j;
+ //#i24363# tab stops relative to indent
+ const long lRightPixMargin = ConvertSizePixel(nRightFrameMargin - nParaItemTxtLeft );
+ const long lParaIndentPix = ConvertSizePixel(lParaIndent);
+ for(j = 0; j < pTabStopItem->Count(); ++j)
+ {
+ const SvxTabStop *pTab = &(*pTabStopItem)[j];
+ pTabs[nTabCount+TAB_GAP].nPos =
+ ConvertHPosPixel(
+ (pRuler_Imp->bIsTabsRelativeToIndent ? lParaIndent : 0 ) + pTab->GetTabPos() + lAppNullOffset);
+ if(bRTL)
+ {
+ pTabs[nTabCount+TAB_GAP].nPos = lParaIndentPix + lRightPixMargin - pTabs[nTabCount+TAB_GAP].nPos;
+ }
+ pTabs[nTabCount+TAB_GAP].nStyle = ToSvTab_Impl(pTab->GetAdjustment());
+ ++nTabCount;
+ }
+ if(!pTabStopItem->Count())
+ pTabs[0].nPos = bRTL ? lRightPixMargin : lParaIndentPix;
+
+ // Rest mit Default-Tabs fuellen
+ if(bRTL)
+ {
+ for(j = 0; j < nDefTabBuf; ++j)
+ {
+ pTabs[nTabCount + TAB_GAP].nPos =
+ pTabs[nTabCount].nPos - nDefTabDist;
+
+ if(j == 0 )
+ pTabs[nTabCount + TAB_GAP].nPos -=
+ ((pTabs[nTabCount + TAB_GAP].nPos - lRightPixMargin)
+ % nDefTabDist );
+ if(pTabs[nTabCount+TAB_GAP].nPos <= lParaIndentPix)
+ break;
+ pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT;
+ ++nTabCount;
+ }
+ }
+ else
+ {
+ for(j = 0; j < nDefTabBuf; ++j)
+ {
+ if( j == 0 )
+ {
+ //set the first default tab stop
+ if(pRuler_Imp->bIsTabsRelativeToIndent)
+ {
+ pTabs[nTabCount + TAB_GAP].nPos =
+ (pTabs[nTabCount].nPos + nDefTabDist);
+ pTabs[nTabCount + TAB_GAP].nPos -=
+ ((pTabs[nTabCount + TAB_GAP].nPos - lParaIndentPix)
+ % nDefTabDist );
+ }
+ else
+ {
+ if( pTabs[nTabCount].nPos < 0 )
+ {
+ pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist ) * nDefTabDist;
+ }
+ else
+ {
+ pTabs[nTabCount + TAB_GAP].nPos = ( pTabs[nTabCount].nPos / nDefTabDist + 1 ) * nDefTabDist;
+ }
+ }
+
+ }
+ else
+ {
+ //simply add the default distance to the last position
+ pTabs[nTabCount + TAB_GAP].nPos =
+ pTabs[nTabCount].nPos + nDefTabDist;
+ }
+
+ if(pTabs[nTabCount+TAB_GAP].nPos >= lRightIndent)
+ break;
+ pTabs[nTabCount + TAB_GAP].nStyle = RULER_TAB_DEFAULT;
+ ++nTabCount;
+ }
+ }
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ DBG_ASSERT(nTabCount + TAB_GAP <= nTabBufSize, "BufferSize zu klein");
+ }
+ else
+ {
+ SetTabs();
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxTabStopItem *pItem // Neuer Wert fuer Tabulatoren
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Tabulatoren merken; alten gfs. loeschen
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pTabStopItem; pTabStopItem = 0;
+ if(pItem)
+ {
+ pTabStopItem = new SvxTabStopItem(*pItem);
+ if(!bHorz)
+ pTabStopItem->SetWhich(SID_ATTR_TABSTOP_VERTICAL);
+ }
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::Update
+(
+ const SvxObjectItem *pItem // Neuer Wert fuer Objekte
+)
+
+/*
+ [Beschreibung]
+
+ Neuen Wert fuer Objekte merken
+
+*/
+
+{
+ if(bActive)
+ {
+ delete pObjectItem; pObjectItem = 0;
+ if(pItem)
+ pObjectItem = new SvxObjectItem(*pItem);
+ StartListening_Impl();
+ }
+}
+
+
+void SvxRuler::SetNullOffsetLogic
+(
+ long lVal // Setzen des logischen NullOffsets
+)
+{
+ lAppNullOffset = lLogicNullOffset - lVal;
+ bAppSetNullOffset = sal_True;
+ Ruler::SetNullOffset(ConvertSizePixel(lVal));
+ Update();
+}
+
+
+void SvxRuler::Update()
+
+/*
+ [Beschreibung]
+
+ Aktualisierung der Anzeige anstossen
+
+*/
+
+{
+ if(IsDrag())
+ return;
+ UpdatePage();
+ UpdateFrame();
+ if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT)
+ UpdateObject();
+ else
+ UpdateColumns();
+
+ if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS |SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL)))
+ UpdatePara();
+ if(0 != (nFlags & SVXRULER_SUPPORT_TABS))
+ UpdateTabs();
+}
+
+
+inline long SvxRuler::GetPageWidth() const
+{
+ return bHorz ? pPagePosItem->GetWidth() : pPagePosItem->GetHeight();
+
+}
+
+
+inline long SvxRuler::GetFrameLeft() const
+
+/*
+ [Beschreibung]
+
+ Erfragen des linken Randes in Pixeln
+
+*/
+
+
+{
+ return bAppSetNullOffset?
+ GetMargin1() + ConvertSizePixel(lLogicNullOffset):
+ Ruler::GetNullOffset();
+}
+
+inline void SvxRuler::SetFrameLeft(long l)
+
+/*
+ [Beschreibung]
+
+ Setzen des linken Randes in Pixeln
+
+*/
+
+{
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ if(bAppSetNullOffset)
+ SetMargin1(l - ConvertSizePixel(lLogicNullOffset),
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE);
+ else
+ Ruler::SetNullOffset(l);
+}
+
+
+long SvxRuler::GetFirstLineIndent() const
+
+/*
+ [Beschreibung]
+
+ Erstzeileneinzug in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_FIRST_LINE].nPos: GetMargin1();
+}
+
+
+long SvxRuler::GetLeftIndent() const
+
+/*
+ [Beschreibung]
+
+ Linken Absatzrand in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_LEFT_MARGIN].nPos: GetMargin1();
+}
+
+
+
+long SvxRuler::GetRightIndent() const
+
+/*
+ [Beschreibung]
+
+ Rechten Absatzrand in Pixels erfragen
+*/
+
+{
+ return pParaItem? pIndents[INDENT_RIGHT_MARGIN].nPos: GetMargin2();
+}
+
+
+long SvxRuler::GetLogicRightIndent() const
+
+/*
+ [Beschreibung]
+
+ Rechten Absatzrand in Logic erfragen
+*/
+
+{
+ return pParaItem ? GetRightFrameMargin()-pParaItem->GetRight() : GetRightFrameMargin();
+}
+
+// linker Rand in App-Werten; ist entweder der Seitenrand (=0)
+// oder der linke Rand der Spalte, die im Spaltenattribut als
+// altuelle Spalte eingestellt ist.
+
+long SvxRuler::GetLeftFrameMargin() const
+{
+ // #126721# for some unknown reason the current column is set to 0xffff
+ DBG_ASSERT(!pColumnItem || pColumnItem->GetActColumn() < pColumnItem->Count(),
+ "issue #126721# - invalid current column!");
+ long nLeft =
+ pColumnItem && pColumnItem->Count() && pColumnItem->GetActColumn() < pColumnItem->Count() ?
+ (*pColumnItem)[pColumnItem->GetActColumn()].nStart : 0;
+ if(pParaBorderItem && (!pColumnItem || pColumnItem->IsTable()))
+ nLeft += pParaBorderItem->GetLeft();
+ return nLeft;
+}
+
+inline long SvxRuler::GetLeftMin() const
+{
+ DBG_ASSERT(pMinMaxItem, "kein MinMax-Wert gesetzt");
+ return pMinMaxItem?
+ bHorz? pMinMaxItem->GetValue().Left(): pMinMaxItem->GetValue().Top()
+ : 0;
+}
+
+inline long SvxRuler::GetRightMax() const
+{
+ DBG_ASSERT(pMinMaxItem, "kein MinMax-Wert gesetzt");
+ return pMinMaxItem?
+ bHorz? pMinMaxItem->GetValue().Right(): pMinMaxItem->GetValue().Bottom()
+ : 0;
+}
+
+
+long SvxRuler::GetRightFrameMargin() const
+
+/*
+ [Beschreibung]
+
+ Rechten umgebenden Rand erfragen (in logischen Einheiten)
+
+*/
+
+{
+ if(pColumnItem)
+ {
+ if(!IsActLastColumn( sal_True ))
+ {
+ long nRet = (*pColumnItem)[GetActRightColumn( sal_True )].nEnd;
+ if(pColumnItem->IsTable() && pParaBorderItem)
+ nRet -= pParaBorderItem->GetRight();
+ return nRet;
+ }
+ }
+
+ long l = lLogicNullOffset;
+
+ // gfs. rechten Tabelleneinzug abziehen
+ if(pColumnItem && pColumnItem->IsTable())
+ l += pColumnItem->GetRight();
+ else if(bHorz && pLRSpaceItem)
+ l += pLRSpaceItem->GetRight();
+ else if(!bHorz && pULSpaceItem)
+ l += pULSpaceItem->GetLower();
+
+ if(pParaBorderItem &&
+ (!pColumnItem || pColumnItem->IsTable()||IsActLastColumn( sal_True )))
+ l += pParaBorderItem->GetRight();
+
+ if(bHorz)
+ l = pPagePosItem->GetWidth() - l;
+ else
+ l = pPagePosItem->GetHeight() - l;
+ return l;
+}
+
+#define NEG_FLAG ( (nFlags & SVXRULER_SUPPORT_NEGATIVE_MARGINS) == \
+ SVXRULER_SUPPORT_NEGATIVE_MARGINS )
+#define TAB_FLAG ( pColumnItem && pColumnItem->IsTable() )
+
+long SvxRuler::GetCorrectedDragPos( sal_Bool bLeft, sal_Bool bRight )
+
+/*
+ [Beschreibung]
+
+ Korrigiert die Position innerhalb der errechneten Grenzwerte.
+ Die Grenzwerte sind in Pixel relativ zum Seitenrand.
+
+*/
+
+{
+ const long lNullPix = Ruler::GetNullOffset();
+ long lDragPos = GetDragPos() + lNullPix;
+ADD_DEBUG_TEXT("lDragPos: ", String::CreateFromInt32(lDragPos))
+ sal_Bool bHoriRows = bHorz && pRuler_Imp->bIsTableRows;
+ if((bLeft || (bHoriRows)) && lDragPos < nMaxLeft)
+ lDragPos = nMaxLeft;
+ else if((bRight||bHoriRows) && lDragPos > nMaxRight)
+ lDragPos = nMaxRight;
+ return lDragPos - lNullPix;
+}
+
+
+
+void ModifyTabs_Impl
+(
+ sal_uInt16 nCount, // Anzahl Tabs
+ RulerTab *pTabs, // Tab-Puffer
+ long lDiff // zu addierende Differenz
+ )
+
+/*
+ [Beschreibung]
+
+ Hilfsroutine; alle Tabs um einen festen Wert verschieben
+
+*/
+{
+ if( pTabs )
+ for(sal_uInt16 i = 0; i < nCount; ++i) pTabs[i].nPos += lDiff;
+}
+
+
+
+void SvxRuler::DragMargin1()
+
+/*
+ [Beschreibung]
+
+ Draggen des linken Frame-Randes
+
+*/
+{
+ const long lDragPos = GetCorrectedDragPos( !TAB_FLAG || !NEG_FLAG, sal_True );
+ DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 3 : 7, bHorz);
+ if(pColumnItem&&
+ (//nDragType & DRAG_OBJECT_SIZE_LINEAR ||
+ nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL))
+ DragBorders();
+ AdjustMargin1(lDragPos);
+}
+void SvxRuler::AdjustMargin1(long lDiff)
+{
+ const long nOld = bAppSetNullOffset? GetMargin1(): GetNullOffset();
+ const long lDragPos = lDiff;
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+
+ const sal_uInt16 nMarginStyle =
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE;
+
+ if(!bAppSetNullOffset)
+ {
+ long _lDiff = lDragPos;
+ SetNullOffset(nOld + _lDiff);
+ if(!pColumnItem||!(nDragType & DRAG_OBJECT_SIZE_LINEAR))
+ {
+ SetMargin2( GetMargin2() - _lDiff, nMarginStyle );
+
+ if(!pColumnItem && !pObjectItem && pParaItem)
+ {
+ // Rechten Einzug an alter Position
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ if(pObjectItem)
+ {
+ pObjectBorders[GetObjectBordersOff(0)].nPos -= _lDiff;
+ pObjectBorders[GetObjectBordersOff(1)].nPos -= _lDiff;
+ SetBorders(2, pObjectBorders + GetObjectBordersOff(0));
+ }
+ if(pColumnItem)
+ {
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ pBorders[i].nPos -= _lDiff;
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ if(pColumnItem->IsFirstAct())
+ {
+ // Rechten Einzug an alter Position
+ if(pParaItem)
+ {
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ else
+ {
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos -= _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos -= _lDiff;
+ pIndents[INDENT_RIGHT_MARGIN].nPos -= _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ if(pTabStopItem&& (nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ &&!IsActFirstColumn())
+ {
+ ModifyTabs_Impl(nTabCount+TAB_GAP, pTabs, -_lDiff);
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ }
+ }
+ }
+ else
+ {
+ long _lDiff = lDragPos - nOld;
+ SetMargin1(nOld + _lDiff, nMarginStyle );
+
+ if(!pColumnItem||!(nDragType & (DRAG_OBJECT_SIZE_LINEAR |
+ DRAG_OBJECT_SIZE_PROPORTIONAL)))
+ {
+ if(!pColumnItem && !pObjectItem && pParaItem)
+ {
+ // Linke Einzuege an alter Position
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+
+ if(pColumnItem)
+ {
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ pBorders[i].nPos += _lDiff;
+ SetBorders(pColumnItem->Count()-1, pBorders);
+ if(pColumnItem->IsFirstAct())
+ {
+ // Linke Einzuege an alter Position
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ else
+ {
+ if(pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += _lDiff;
+ pIndents[INDENT_LEFT_MARGIN].nPos += _lDiff;
+ pIndents[INDENT_RIGHT_MARGIN].nPos += _lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+ }
+ }
+ if(pTabStopItem)
+ {
+ ModifyTabs_Impl(nTabCount+TAB_GAP, pTabs, _lDiff);
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ }
+ }
+}
+
+
+void SvxRuler::DragMargin2()
+/*
+ [Beschreibung]
+
+ Draggen des rechten Frame-Randes
+
+*/
+{
+ const long lDragPos = GetCorrectedDragPos( sal_True, !TAB_FLAG || !NEG_FLAG);
+ DrawLine_Impl(lTabPos, ( TAB_FLAG && NEG_FLAG ) ? 5 : 7, bHorz);
+ long lDiff = lDragPos - GetMargin2();
+
+ if(pRuler_Imp->bIsTableRows && !bHorz && pColumnItem&&
+ (//nDragType & DRAG_OBJECT_SIZE_LINEAR ||
+ nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL))
+ DragBorders();
+
+ sal_Bool bProtectColumns =
+ pRuler_Imp->aProtectItem.IsSizeProtected() ||
+ pRuler_Imp->aProtectItem.IsPosProtected();
+ const sal_uInt16 nMarginStyle =
+ bProtectColumns ? 0 : RULER_MARGIN_SIZEABLE;
+ SetMargin2( lDragPos, nMarginStyle );
+
+ // Rechten Einzug an alter Position
+ if((!pColumnItem || IsActLastColumn()) && pParaItem)
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += lDiff;
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ }
+}
+
+
+void SvxRuler::DragIndents()
+/*
+ [Beschreibung]
+
+ Draggen der Absatzeinzuege
+
+*/
+{
+ const long lDragPos = NEG_FLAG ? GetDragPos() : GetCorrectedDragPos();
+ const sal_uInt16 nIdx = GetDragAryPos()+INDENT_GAP;
+ const long lDiff = pIndents[nIdx].nPos - lDragPos;
+
+ if((nIdx == INDENT_FIRST_LINE ||
+ nIdx == INDENT_LEFT_MARGIN ) &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ pIndents[INDENT_FIRST_LINE].nPos -= lDiff;
+
+ pIndents[nIdx].nPos = lDragPos;
+
+ SetIndents(INDENT_COUNT, pIndents + INDENT_GAP);
+ DrawLine_Impl(lTabPos, 1, bHorz);
+}
+
+
+void SvxRuler::DrawLine_Impl(long &_lTabPos, int nNew, sal_Bool Hori)
+/*
+ [Beschreibung]
+
+ Ausgaberoutine fuer Hilfslinie beim Vereschieben von Tabs, Tabellen-
+ und anderen Spalten
+
+*/
+{
+ if(Hori)
+ {
+ const long nHeight = pEditWin->GetOutputSize().Height();
+ Point aZero=pEditWin->GetMapMode().GetOrigin();
+ if(_lTabPos!=-1)
+ pEditWin->InvertTracking(
+ Rectangle( Point(_lTabPos, -aZero.Y()),
+ Point(_lTabPos, -aZero.Y()+nHeight)),
+ SHOWTRACK_SPLIT | SHOWTRACK_CLIP );
+ if( nNew & 1 )
+ {
+
+ _lTabPos = ConvertHSizeLogic(
+ GetCorrectedDragPos( ( nNew&4 ) != 0, ( nNew&2 ) != 0 ) +
+ GetNullOffset() );
+ if(pPagePosItem)
+ _lTabPos += pPagePosItem->GetPos().X();
+ pEditWin->InvertTracking(
+ Rectangle(Point(_lTabPos, -aZero.Y()),
+ Point(_lTabPos, -aZero.Y()+nHeight)),
+ SHOWTRACK_CLIP | SHOWTRACK_SPLIT );
+ }
+ }
+ else
+ {
+ const long nWidth = pEditWin->GetOutputSize().Width();
+ Point aZero=pEditWin->GetMapMode().GetOrigin();
+ if(_lTabPos != -1)
+ {
+ pEditWin->InvertTracking(
+ Rectangle( Point(-aZero.X(), _lTabPos),
+ Point(-aZero.X()+nWidth, _lTabPos)),
+ SHOWTRACK_SPLIT | SHOWTRACK_CLIP );
+ }
+
+ if(nNew & 1)
+ {
+ _lTabPos = ConvertVSizeLogic(GetCorrectedDragPos()+GetNullOffset());
+ if(pPagePosItem)
+ _lTabPos += pPagePosItem->GetPos().Y();
+ pEditWin->InvertTracking(
+ Rectangle( Point(-aZero.X(), _lTabPos),
+ Point(-aZero.X()+nWidth, _lTabPos)),
+ SHOWTRACK_CLIP | SHOWTRACK_SPLIT );
+ }
+ }
+}
+
+
+
+
+void SvxRuler::DragTabs()
+
+/*
+ [Beschreibung]
+
+ Draggen von Tabs
+
+*/
+{
+
+ long lDragPos = GetCorrectedDragPos(sal_True, sal_False);
+
+ sal_uInt16 nIdx = GetDragAryPos()+TAB_GAP;
+ DrawLine_Impl(lTabPos, 7, bHorz);
+
+ long nDiff = lDragPos - pTabs[nIdx].nPos;
+
+ if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+
+ for(sal_uInt16 i = nIdx; i < nTabCount; ++i)
+ {
+ pTabs[i].nPos += nDiff;
+ // auf Maximum begrenzen
+ if(pTabs[i].nPos > GetMargin2())
+ pTabs[nIdx].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[nIdx].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ pRuler_Imp->nTotalDist -= nDiff;
+ pTabs[nIdx].nPos = lDragPos;
+ for(sal_uInt16 i = nIdx+1; i < nTabCount; ++i)
+ {
+ if(pTabs[i].nStyle & RULER_TAB_DEFAULT)
+ // bei den DefaultTabs kann abgebrochen werden
+ break;
+ long nDelta = pRuler_Imp->nTotalDist * pRuler_Imp->pPercBuf[i];
+ nDelta /= 1000;
+ pTabs[i].nPos = pTabs[nIdx].nPos + nDelta;
+ if(pTabs[i].nPos+GetNullOffset() > nMaxRight)
+ pTabs[i].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[i].nStyle &= ~RULER_STYLE_INVISIBLE;
+ }
+ }
+ else
+ pTabs[nIdx].nPos = lDragPos;
+
+ if(IsDragDelete())
+ pTabs[nIdx].nStyle |= RULER_STYLE_INVISIBLE;
+ else
+ pTabs[nIdx].nStyle &= ~RULER_STYLE_INVISIBLE;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+}
+
+
+
+void SvxRuler::SetActive(sal_Bool bOn)
+{
+ if(bOn)
+ {
+ Activate();
+/* pBindings->Invalidate( SID_RULER_LR_MIN_MAX, sal_True, sal_True );
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Invalidate( SID_ATTR_LONG_ULSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Invalidate( SID_ATTR_LONG_LRSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Invalidate( SID_RULER_PAGE_POS, sal_True, sal_True );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Invalidate( SID_ATTR_TABSTOP, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_TABSTOP );
+ pBindings->Invalidate( SID_ATTR_PARA_LRSPACE, sal_True, sal_True );
+ pBindings->Update( SID_ATTR_PARA_LRSPACE );
+ pBindings->Invalidate( SID_RULER_BORDERS, sal_True, sal_True );
+ pBindings->Update( SID_RULER_BORDERS );
+ pBindings->Invalidate( SID_RULER_OBJECT, sal_True, sal_True );
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Invalidate( SID_RULER_PROTECT, sal_True, sal_True );
+ pBindings->Update( SID_RULER_PROTECT );*/
+ }
+ else
+ Deactivate();
+ if(bActive!=bOn)
+ {
+ pBindings->EnterRegistrations();
+ if(bOn)
+ for(sal_uInt16 i=0;i<pRuler_Imp->nControlerItems;i++)
+ pCtrlItem[i]->ReBind();
+ else
+ for(sal_uInt16 j=0;j<pRuler_Imp->nControlerItems;j++)
+ pCtrlItem[j]->UnBind();
+ pBindings->LeaveRegistrations();
+ }
+ bActive = bOn;
+}
+
+
+
+
+void SvxRuler::UpdateParaContents_Impl
+(
+ long l, // Differenz
+ UpdateType eType // Art (alle, links oder rechts)
+)
+
+/*
+ [Beschreibung]
+
+ Hilfsroutine; Mitfuehren von Tabulatoren und Absatzraendern
+
+*/
+{
+ switch(eType) {
+ case MOVE_RIGHT:
+ pIndents[INDENT_RIGHT_MARGIN].nPos += l;
+ break;
+ case MOVE_ALL:
+ pIndents[INDENT_RIGHT_MARGIN].nPos += l;
+ // no break
+ case MOVE_LEFT:
+ {
+ pIndents[INDENT_FIRST_LINE].nPos += l;
+ pIndents[INDENT_LEFT_MARGIN].nPos += l;
+ if ( pTabs )
+ {
+ for(sal_uInt16 i = 0; i < nTabCount+TAB_GAP;++i)
+ pTabs[i].nPos += l;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ break;
+ }
+ }
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+}
+
+
+
+void SvxRuler::DragBorders()
+
+/*
+ [Beschreibung]
+
+ Draggen von Borders (Tabellen- und anderen Spalten)
+
+*/
+{
+ sal_Bool bLeftIndentsCorrected = sal_False, bRightIndentsCorrected = sal_False;
+ int nIdx;
+
+ if(GetDragType()==RULER_TYPE_BORDER)
+ {
+ DrawLine_Impl(lTabPos, 7, bHorz);
+ nIdx = GetDragAryPos();
+ }
+ else
+ nIdx=0;
+
+ sal_uInt16 nDragSize = GetDragSize();
+ long lDiff = 0;
+
+ // the drag position has to be corrected to be able to prevent borders from passing each other
+ long lPos = GetCorrectedDragPos();
+
+
+ switch(nDragSize)
+ {
+ case RULER_DRAGSIZE_MOVE:
+ {
+ADD_DEBUG_TEXT("lLastLMargin: ", String::CreateFromInt32(pRuler_Imp->lLastLMargin))
+ lDiff = GetDragType()==RULER_TYPE_BORDER ?
+ lPos-nDragOffset - pBorders[nIdx].nPos
+ : GetDragType() == RULER_TYPE_MARGIN1 ? lPos - pRuler_Imp->lLastLMargin : lPos - pRuler_Imp->lLastRMargin;
+
+// pBorders[nIdx].nPos += lDiff;
+// lDiff = pBorders[nIdx].nPos - nOld;
+ if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ long nRight = GetMargin2()-lMinFrame; // rechter Begrenzer
+ for(int i = nBorderCount-2; i >= nIdx; --i)
+ {
+ long l = pBorders[i].nPos;
+ pBorders[i].nPos += lDiff;
+ pBorders[i].nPos = Min(pBorders[i].nPos, nRight - pBorders[i].nWidth);
+ nRight = pBorders[i].nPos - lMinFrame;
+ // RR der Spalte aktualisieren
+ if(i == GetActRightColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_RIGHT);
+ bRightIndentsCorrected = sal_True;
+ }
+ // LAR, EZE der Spalte aktualisieren
+ else if(i == GetActLeftColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_LEFT);
+ bLeftIndentsCorrected = sal_True;
+ }
+ }
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ int nLimit;
+ long lLeft;
+ int nStartLimit = nBorderCount-2;
+ switch(GetDragType())
+ {
+ default: ;//prevent warning
+ DBG_ERROR("svx::SvxRuler::DragBorders(), unknown drag type!" );
+ case RULER_TYPE_BORDER:
+ if(pRuler_Imp->bIsTableRows)
+ {
+ pBorders[nIdx].nPos += lDiff;
+ if(bHorz)
+ {
+ lLeft = pBorders[nIdx].nPos;
+ pRuler_Imp->nTotalDist -= lDiff;
+ nLimit=nIdx+1;
+ }
+ else
+ {
+ lLeft = 0;
+ nStartLimit = nIdx - 1;
+ pRuler_Imp->nTotalDist += lDiff;
+ nLimit = 0;
+ }
+ }
+ else
+ {
+ nLimit=nIdx+1;
+ pBorders[nIdx].nPos += lDiff;
+ lLeft = pBorders[nIdx].nPos;
+ pRuler_Imp->nTotalDist-=lDiff;
+ }
+ break;
+ case RULER_TYPE_MARGIN1:
+ nLimit=0;
+ lLeft=pRuler_Imp->lLastLMargin+lDiff;
+ pRuler_Imp->nTotalDist-=lDiff;
+ break;
+ case RULER_TYPE_MARGIN2:
+ nLimit = 0;
+ lLeft= 0;//pRuler_Imp->lLastRMargin + lDiff;
+ nStartLimit = nBorderCount - 2;
+ pRuler_Imp->nTotalDist += lDiff;
+ break;
+ }
+
+ for(int i = nStartLimit; i >= nLimit; --i)
+ {
+
+ long l = pBorders[i].nPos;
+ pBorders[i].nPos=lLeft+
+ (pRuler_Imp->nTotalDist*pRuler_Imp->pPercBuf[i])/1000+
+ pRuler_Imp->pBlockBuf[i];
+
+ // RR der Spalte aktualisieren
+ if(!pRuler_Imp->bIsTableRows)
+ {
+ if(i == GetActRightColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_RIGHT);
+ bRightIndentsCorrected = sal_True;
+ }
+ // LAR, EZE der Spalte aktualisieren
+ else if(i == GetActLeftColumn())
+ {
+ UpdateParaContents_Impl(pBorders[i].nPos - l, MOVE_LEFT);
+ bLeftIndentsCorrected = sal_True;
+ }
+ }
+ }
+ if(pRuler_Imp->bIsTableRows)
+ {
+ //in vertical tables the left borders have to be moved
+ if(bHorz)
+ {
+ for(int i = 0; i < nIdx; ++i)
+ pBorders[i].nPos += lDiff;
+ AdjustMargin1(lDiff);
+ }
+ else
+ {
+ //otherwise the right borders are moved
+ for(int i = pColumnItem->Count() - 1; i > nIdx; --i)
+ pBorders[i].nPos += lDiff;
+ SetMargin2( GetMargin2() + lDiff, 0 );
+ }
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ //moving rows: if a row is resized all following rows
+ //have to be moved by the same amount.
+ //This includes the left border when the table is not limited
+ //to a lower frame border.
+ int nLimit;
+ long lLeft;
+ if(GetDragType()==RULER_TYPE_BORDER)
+ {
+ nLimit=nIdx+1;
+ lLeft=(pBorders[nIdx].nPos+=lDiff);
+ }
+ else
+ {
+ nLimit=0;
+ lLeft=pRuler_Imp->lLastLMargin+lDiff;
+ }
+ //in vertical tables the left borders have to be moved
+ if(bHorz)
+ {
+ for(int i = 0; i < nIdx; ++i)
+ {
+ pBorders[i].nPos += lDiff;
+ }
+ AdjustMargin1(lDiff);
+ }
+ else
+ {
+ //otherwise the right borders are moved
+ for(int i = nBorderCount-2; i >= nLimit; --i)
+ {
+ pBorders[i].nPos += lDiff;
+ }
+ SetMargin2( GetMargin2() + lDiff, 0 );
+ }
+ }
+ else
+ pBorders[nIdx].nPos+=lDiff;
+ break;
+ }
+ case RULER_DRAGSIZE_1:
+ {
+ lDiff = lPos - pBorders[nIdx].nPos;
+ pBorders[nIdx].nWidth += pBorders[nIdx].nPos - lPos;
+ pBorders[nIdx].nPos = lPos;
+ break;
+ }
+ case RULER_DRAGSIZE_2:
+ {
+ const long nOld = pBorders[nIdx].nWidth;
+ pBorders[nIdx].nWidth = lPos - pBorders[nIdx].nPos;
+ lDiff = pBorders[nIdx].nWidth - nOld;
+ break;
+ }
+ }
+ if(!bRightIndentsCorrected &&
+ GetActRightColumn() == nIdx &&
+ nDragSize != RULER_DRAGSIZE_2 && pIndents &&
+ !pRuler_Imp->bIsTableRows)
+ {
+ UpdateParaContents_Impl(lDiff, MOVE_RIGHT);
+ }
+ else if(!bLeftIndentsCorrected &&
+ GetActLeftColumn()==nIdx &&
+ nDragSize != RULER_DRAGSIZE_1 && pIndents)
+ {
+ UpdateParaContents_Impl(lDiff, MOVE_LEFT);
+ }
+ SetBorders(pColumnItem->Count()-1, pBorders);
+}
+
+
+void SvxRuler::DragObjectBorder()
+
+/*
+ [Beschreibung]
+
+ Draggen von Objektraendern
+
+*/
+{
+ if(RULER_DRAGSIZE_MOVE == GetDragSize())
+ {
+ const long lPos = GetCorrectedDragPos();
+ const sal_uInt16 nIdx = GetDragAryPos();
+ pObjectBorders[GetObjectBordersOff(nIdx)].nPos = lPos;
+ SetBorders(2, pObjectBorders + GetObjectBordersOff(0));
+ DrawLine_Impl(lTabPos, 7, bHorz);
+
+ }
+}
+
+
+void SvxRuler::ApplyMargins()
+/*
+ [Beschreibung]
+
+ Anwenden von Randeinstellungen; durch Draggen veraendert.
+
+*/
+{
+ const SfxPoolItem *pItem = 0;
+ sal_uInt16 nId = SID_ATTR_LONG_LRSPACE;
+ if(bHorz)
+ {
+ const long lOldNull = lLogicNullOffset;
+ if(pRuler_Imp->lMaxLeftLogic!=-1&&nMaxLeft==GetMargin1()+Ruler::GetNullOffset())
+ pLRSpaceItem->SetLeft(lLogicNullOffset=pRuler_Imp->lMaxLeftLogic);
+ else
+ pLRSpaceItem->SetLeft(PixelHAdjust(
+ lLogicNullOffset = ConvertHPosLogic(GetFrameLeft()) -
+ lAppNullOffset, pLRSpaceItem->GetLeft()));
+
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - lOldNull;
+
+ if(pRuler_Imp->lMaxRightLogic!=-1
+ &&nMaxRight==GetMargin2()+Ruler::GetNullOffset())
+ pLRSpaceItem->SetRight(GetPageWidth()-pRuler_Imp->lMaxRightLogic);
+ else
+ pLRSpaceItem->SetRight(
+ PixelHAdjust(
+ Max((long)0,pPagePosItem->GetWidth() -
+ pLRSpaceItem->GetLeft() -
+ (ConvertHPosLogic(GetMargin2()) -
+ lAppNullOffset)),pLRSpaceItem->GetRight()));
+ pItem = pLRSpaceItem;
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pLRSpaceItem);
+#endif // DEBUGLIN
+ }
+ else {
+ const long lOldNull = lLogicNullOffset;
+ pULSpaceItem->SetUpper(
+ PixelVAdjust(
+ lLogicNullOffset =
+ ConvertVPosLogic(GetFrameLeft()) -
+ lAppNullOffset,pULSpaceItem->GetUpper()));
+ if(bAppSetNullOffset)
+ lAppNullOffset += lLogicNullOffset - lOldNull;
+ pULSpaceItem->SetLower(
+ PixelVAdjust(
+ Max((long)0, pPagePosItem->GetHeight() -
+ pULSpaceItem->GetUpper() -
+ (ConvertVPosLogic(GetMargin2()) -
+ lAppNullOffset)),pULSpaceItem->GetLower()));
+ pItem = pULSpaceItem;
+ nId = SID_ATTR_LONG_ULSPACE;
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pULSpaceItem);
+#endif // DEBUGLIN
+ }
+ pBindings->GetDispatcher()->Execute( nId, SFX_CALLMODE_RECORD, pItem, 0L );
+ if(pTabStopItem)
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyIndents()
+/*
+ [Beschreibung]
+
+ Anwenden von Absatzeinstellungen; durch Draggen veraendert.
+
+*/
+{
+ long nNewTxtLeft;
+ if(pColumnItem&&!IsActFirstColumn( sal_True ))
+ {
+ long nLeftCol=GetActLeftColumn( sal_True );
+ nNewTxtLeft =
+ PixelHAdjust(
+ ConvertHPosLogic(
+ pIndents[INDENT_LEFT_MARGIN].nPos-
+ (pBorders[nLeftCol].nPos +
+ pBorders[nLeftCol].nWidth))-
+ lAppNullOffset,pParaItem->GetTxtLeft());
+ }
+ else
+ nNewTxtLeft =
+ PixelHAdjust(
+ ConvertHPosLogic(pIndents[INDENT_LEFT_MARGIN].nPos),
+ pParaItem->GetTxtLeft());
+
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+
+ long nNewFirstLineOffset;
+ if(bRTL)
+ {
+ long nRightFrameMargin = GetRightFrameMargin();
+ nNewFirstLineOffset = PixelHAdjust(nRightFrameMargin -
+ ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos ) -
+ lAppNullOffset,
+ pParaItem->GetTxtFirstLineOfst());
+ }
+ else
+ nNewFirstLineOffset=
+ PixelHAdjust(
+ ConvertHPosLogic(pIndents[INDENT_FIRST_LINE].nPos -
+ pIndents[INDENT_LEFT_MARGIN].nPos) -
+ lAppNullOffset,
+ pParaItem->GetTxtFirstLineOfst());
+
+ // #62986# : Ist der neue TxtLeft kleiner als der alte FirstLineIndent,
+ // dann geht die Differenz verloren und der Absatz wird insgesamt
+ // zu weit eingerueckt, deswegen erst den FirstLineOffset setzen, dann den TxtLeft
+ if(bRTL)
+ {
+ long nLeftFrameMargin = GetLeftFrameMargin();
+ long nRightFrameMargin = GetRightFrameMargin();
+ nNewTxtLeft = nRightFrameMargin - nNewTxtLeft - nLeftFrameMargin;
+ nNewFirstLineOffset -= nNewTxtLeft;
+ if(pParaBorderItem)
+ {
+ nNewTxtLeft += pParaBorderItem->GetLeft() + pParaBorderItem->GetRight();
+ nNewFirstLineOffset -= pParaBorderItem->GetRight();
+ }
+ }
+ pParaItem->SetTxtFirstLineOfst(
+ sal::static_int_cast< short >(nNewFirstLineOffset));
+ pParaItem->SetTxtLeft(nNewTxtLeft);
+
+ if(pColumnItem && ((!bRTL && !IsActLastColumn( sal_True ))|| (bRTL && !IsActFirstColumn())))
+ {
+ if(bRTL)
+ {
+ long nActBorder = pBorders[GetActLeftColumn( sal_True )].nPos;
+ long nRightMargin = pIndents[INDENT_RIGHT_MARGIN].nPos;
+ long nConvert = ConvertHPosLogic( nRightMargin - nActBorder );
+ pParaItem->SetRight( PixelHAdjust( nConvert - lAppNullOffset, pParaItem->GetRight() ) );
+ }
+ else
+ {
+ pParaItem->SetRight(
+ PixelHAdjust(
+ ConvertHPosLogic(
+ pBorders[GetActRightColumn( sal_True )].nPos -
+ pIndents[INDENT_RIGHT_MARGIN].nPos) -
+ lAppNullOffset,
+ pParaItem->GetRight()));
+ }
+
+ }
+ else
+ {
+ if(bRTL)
+ {
+ pParaItem->SetRight( PixelHAdjust(
+ ConvertHPosLogic(GetMargin1() +
+ pIndents[INDENT_RIGHT_MARGIN].nPos) - GetLeftFrameMargin() +
+ (pParaBorderItem ? pParaBorderItem->GetLeft() : 0) -
+ lAppNullOffset, pParaItem->GetRight()));
+ }
+ else
+ {
+ pParaItem->SetRight( PixelHAdjust(
+ ConvertHPosLogic(GetMargin2() -
+ pIndents[INDENT_RIGHT_MARGIN].nPos) -
+ lAppNullOffset, pParaItem->GetRight()));
+ }
+ }
+ sal_uInt16 nParaId = bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nParaId, SFX_CALLMODE_RECORD, pParaItem, 0L );
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyTabs()
+/*
+ [Beschreibung]
+
+ Anwenden von Tabulatoreinstellungen; durch Draggen veraendert.
+
+*/
+{
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ const sal_uInt16 nCoreIdx = GetDragAryPos();
+ if(IsDragDelete())
+ {
+ pTabStopItem->Remove(nCoreIdx);
+ }
+ else if(DRAG_OBJECT_SIZE_LINEAR & nDragType ||
+ DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType)
+ {
+ SvxTabStopItem *pItem = new SvxTabStopItem(pTabStopItem->Which());
+ //remove default tab stops
+ for ( sal_uInt16 i = 0; i < pItem->Count(); )
+ {
+ if ( SVX_TAB_ADJUST_DEFAULT == (*pItem)[i].GetAdjustment() )
+ {
+ pItem->Remove(i);
+ continue;
+ }
+ ++i;
+ }
+
+ sal_uInt16 j;
+ for(j = 0; j < nCoreIdx; ++j)
+ {
+ pItem->Insert((*pTabStopItem)[j]);
+ }
+ for(; j < pTabStopItem->Count(); ++j)
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[j];
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic(pTabs[j+TAB_GAP].nPos -
+ GetLeftIndent()) -
+ lAppNullOffset,
+ aTabStop.GetTabPos());
+ pItem->Insert(aTabStop);
+ }
+ delete pTabStopItem;
+ pTabStopItem = pItem;
+ }
+ else if( pTabStopItem->Count() == 0 )
+ return;
+ else
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[nCoreIdx];
+ if(pRuler_Imp->lMaxRightLogic!=-1&&
+ pTabs[nCoreIdx+TAB_GAP].nPos+Ruler::GetNullOffset()==nMaxRight)
+ aTabStop.GetTabPos() = pRuler_Imp->lMaxRightLogic-lLogicNullOffset;
+ else
+ {
+ if(bRTL)
+ {
+ //#i24363# tab stops relative to indent
+ const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset );
+
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic( nTmpLeftIndent - pTabs[nCoreIdx+TAB_GAP].nPos) - lAppNullOffset,
+ aTabStop.GetTabPos());
+ }
+ else
+ {
+ //#i24363# tab stops relative to indent
+ const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ 0;
+
+ aTabStop.GetTabPos() = PixelHAdjust(
+ ConvertHPosLogic( pTabs[nCoreIdx+TAB_GAP].nPos - nTmpLeftIndent ) - lAppNullOffset,
+ aTabStop.GetTabPos() );
+ }
+ }
+ pTabStopItem->Remove(nCoreIdx);
+ pTabStopItem->Insert(aTabStop);
+ }
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nTabStopId, SFX_CALLMODE_RECORD, pTabStopItem, 0L );
+ UpdateTabs();
+}
+
+
+void SvxRuler::ApplyBorders()
+/*
+ [Beschreibung]
+
+ Anwenden von (Tabellen-)Spalteneinstellungen; durch Draggen veraendert.
+
+*/
+{
+ if(pColumnItem->IsTable())
+ {
+ long l = GetFrameLeft();
+ if(l != pRuler_Imp->nColLeftPix)
+ pColumnItem->SetLeft( PixelHAdjust(
+ ConvertHPosLogic(l) - lAppNullOffset, pColumnItem->GetLeft()));
+ l = GetMargin2();
+ if(l != pRuler_Imp->nColRightPix)
+ {
+ long nWidthOrHeight = bHorz ? pPagePosItem->GetWidth() : pPagePosItem->GetHeight();
+ pColumnItem->SetRight( PixelHAdjust( nWidthOrHeight -
+ pColumnItem->GetLeft() - ConvertHPosLogic(l) -
+ lAppNullOffset, pColumnItem->GetRight() ) );
+ }
+ }
+ for(sal_uInt16 i = 0; i < pColumnItem->Count()-1; ++i)
+ {
+ long& nEnd = (*pColumnItem)[i].nEnd;
+ nEnd = PIXEL_H_ADJUST(
+ ConvertPosLogic(pBorders[i].nPos),
+ (*pColumnItem)[i].nEnd);
+ long& nStart = (*pColumnItem)[i+1].nStart;
+ nStart = PIXEL_H_ADJUST(
+ ConvertSizeLogic(pBorders[i].nPos +
+ pBorders[i].nWidth) -
+ lAppNullOffset,
+ (*pColumnItem)[i+1].nStart);
+ // Es kann sein, dass aufgrund der PIXEL_H_ADJUST rejustierung auf
+ // alte Werte die Breite < 0 wird. Das rerejustieren wir.
+ if( nEnd > nStart )
+ nStart = nEnd;
+ }
+#ifdef DEBUGLIN
+ Debug_Impl(pEditWin,*pColumnItem);
+#endif // DEBUGLIN
+ SfxBoolItem aFlag(SID_RULER_ACT_LINE_ONLY,
+ nDragType & DRAG_OBJECT_ACTLINE_ONLY? sal_True : sal_False);
+ sal_uInt16 nColId = pRuler_Imp->bIsTableRows ? (bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL) :
+ (bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->GetDispatcher()->Execute( nColId, SFX_CALLMODE_RECORD, pColumnItem, &aFlag, 0L );
+}
+
+void SvxRuler::ApplyObject()
+/*
+ [Beschreibung]
+
+ Anwenden von Objekteinstellungen; durch Draggen veraendert.
+
+*/
+{
+ // zum Seitenrand
+ long nMargin = pLRSpaceItem? pLRSpaceItem->GetLeft(): 0;
+ pObjectItem->SetStartX(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[0].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetStartX()));
+ pObjectItem->SetEndX(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[1].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetEndX()));
+ nMargin = pULSpaceItem? pULSpaceItem->GetUpper(): 0;
+ pObjectItem->SetStartY(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[2].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetStartY()));
+ pObjectItem->SetEndY(
+ PixelAdjust(
+ ConvertPosLogic(pObjectBorders[3].nPos)
+ + nMargin - lAppNullOffset,pObjectItem->GetEndY()));
+ pBindings->GetDispatcher()->Execute( SID_RULER_OBJECT, SFX_CALLMODE_RECORD, pObjectItem, 0L );
+}
+
+void SvxRuler::PrepareProportional_Impl(RulerType eType)
+/*
+ [Beschreibung]
+
+ Vorbereitung proportionales Draggen; es wird der proportionale
+ Anteil bezogen auf die Gesamtbreite in Promille berechnet.
+
+*/
+{
+ pRuler_Imp->nTotalDist = GetMargin2();
+ switch((int)eType)
+ {
+ case RULER_TYPE_MARGIN2:
+ case RULER_TYPE_MARGIN1:
+ case RULER_TYPE_BORDER:
+ {
+ DBG_ASSERT(pColumnItem, "kein ColumnItem");
+
+ pRuler_Imp->SetPercSize(pColumnItem->Count());
+
+ long lPos;
+ long lWidth=0;
+ sal_uInt16 nStart;
+ sal_uInt16 nIdx=GetDragAryPos();
+ lWidth=0;
+ long lActWidth=0;
+ long lActBorderSum;
+ long lOrigLPos;
+
+ if(eType != RULER_TYPE_BORDER)
+ {
+ lOrigLPos = GetMargin1();
+ nStart = 0;
+ lActBorderSum = 0;
+ }
+ else
+ {
+ if(pRuler_Imp->bIsTableRows &&!bHorz)
+ {
+ lOrigLPos = GetMargin1();
+ nStart = 0;
+ }
+ else
+ {
+ lOrigLPos = pBorders[nIdx].nPos + pBorders[nIdx].nWidth;
+ nStart = 1;
+ }
+ lActBorderSum = pBorders[nIdx].nWidth;
+ }
+
+ //in horizontal mode the percentage value has to be
+ //calculated on a "current change" position base
+ //because the height of the table changes while dragging
+ if(pRuler_Imp->bIsTableRows && RULER_TYPE_BORDER == eType)
+ {
+ sal_uInt16 nStartBorder;
+ sal_uInt16 nEndBorder;
+ if(bHorz)
+ {
+ nStartBorder = nIdx + 1;
+ nEndBorder = pColumnItem->Count() - 1;
+ }
+ else
+ {
+ nStartBorder = 0;
+ nEndBorder = nIdx;
+ }
+
+ lWidth = pBorders[nIdx].nPos;
+ if(bHorz)
+ lWidth = GetMargin2() - lWidth;
+ pRuler_Imp->nTotalDist = lWidth;
+ lPos = lOrigLPos = pBorders[nIdx].nPos;
+
+ for(sal_uInt16 i = nStartBorder; i < nEndBorder; ++i)
+ {
+ if(bHorz)
+ {
+ lActWidth += pBorders[i].nPos - lPos;
+ lPos = pBorders[i].nPos + pBorders[i].nWidth;
+ }
+ else
+ lActWidth = pBorders[i].nPos;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000)
+ / pRuler_Imp->nTotalDist);
+ pRuler_Imp->pBlockBuf[i] = (sal_uInt16)lActBorderSum;
+ lActBorderSum += pBorders[i].nWidth;
+ }
+ }
+ else
+ {
+ lPos = lOrigLPos;
+ for(sal_uInt16 ii = nStart; ii < pColumnItem->Count() - 1; ++ii)
+ {
+ lWidth += pBorders[ii].nPos - lPos;
+ lPos = pBorders[ii].nPos + pBorders[ii].nWidth;
+ }
+
+ lWidth += GetMargin2() - lPos;
+ pRuler_Imp->nTotalDist = lWidth;
+ lPos = lOrigLPos;
+
+ for(sal_uInt16 i = nStart; i < pColumnItem->Count() - 1; ++i)
+ {
+ lActWidth += pBorders[i].nPos - lPos;
+ lPos = pBorders[i].nPos + pBorders[i].nWidth;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000)
+ / pRuler_Imp->nTotalDist);
+ pRuler_Imp->pBlockBuf[i] = (sal_uInt16)lActBorderSum;
+ lActBorderSum += pBorders[i].nWidth;
+ }
+ }
+ }
+ break;
+ case RULER_TYPE_TAB:
+ {
+ const sal_uInt16 nIdx = GetDragAryPos()+TAB_GAP;
+ pRuler_Imp->nTotalDist -= pTabs[nIdx].nPos;
+ pRuler_Imp->SetPercSize(nTabCount);
+ for(sal_uInt16 n=0;n<=nIdx;pRuler_Imp->pPercBuf[n++]=0) ;
+ for(sal_uInt16 i = nIdx+1; i < nTabCount; ++i)
+ {
+ const long nDelta = pTabs[i].nPos - pTabs[nIdx].nPos;
+ pRuler_Imp->pPercBuf[i] = (sal_uInt16)((nDelta * 1000) / pRuler_Imp->nTotalDist);
+ }
+ break;
+ }
+ }
+}
+
+
+void SvxRuler::EvalModifier()
+
+/*
+ [Beschreibung]
+
+ Modifier Draggen auswerten
+
+ Shift: Linear verschieben
+ Control: Proportional verschieben
+ Shift+Control: Tabelle: nur aktuelle Zeile
+ alt: Bemassungspfeile (n.i.) //!!
+
+*/
+
+{
+ sal_uInt16 nModifier = GetDragModifier();
+ if(pRuler_Imp->bIsTableRows)
+ {
+ //rows can only be moved in one way, additionally current column is possible
+ if(nModifier == KEY_SHIFT)
+ nModifier = 0;
+ }
+ switch(nModifier)
+ {
+ case KEY_SHIFT:
+ nDragType = DRAG_OBJECT_SIZE_LINEAR;
+ break;
+ case KEY_MOD1: {
+ const RulerType eType = GetDragType();
+ nDragType = DRAG_OBJECT_SIZE_PROPORTIONAL;
+ if( RULER_TYPE_TAB == eType ||
+ ( ( RULER_TYPE_BORDER == eType || RULER_TYPE_MARGIN1 == eType ) &&
+ pColumnItem ) )
+ PrepareProportional_Impl(eType);
+ break;
+ }
+ case KEY_MOD1 | KEY_SHIFT:
+ if(GetDragType()!=RULER_TYPE_MARGIN1&&
+ GetDragType()!=RULER_TYPE_MARGIN2)
+ nDragType = DRAG_OBJECT_ACTLINE_ONLY;
+ break;
+ // alt: Bemassungspfeile
+ }
+}
+
+
+void __EXPORT SvxRuler::Click()
+
+/*
+ [Beschreibung]
+
+ Ueberladener Handler SV; setzt Tab per Dispatcheraufruf
+
+*/
+
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/Click"));
+ Ruler::Click();
+ if( bActive )
+ {
+ pBindings->Update( SID_RULER_LR_MIN_MAX );
+ pBindings->Update( SID_ATTR_LONG_ULSPACE );
+ pBindings->Update( SID_ATTR_LONG_LRSPACE );
+ pBindings->Update( SID_RULER_PAGE_POS );
+ pBindings->Update( bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL);
+ pBindings->Update( bHorz ? SID_ATTR_PARA_LRSPACE : SID_ATTR_PARA_LRSPACE_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL);
+ pBindings->Update( bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL);
+ pBindings->Update( SID_RULER_OBJECT );
+ pBindings->Update( SID_RULER_PROTECT );
+ pBindings->Update( SID_ATTR_PARA_LRSPACE_VERTICAL );
+ }
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ if(pTabStopItem &&
+ (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS)
+ {
+ sal_Bool bContentProtected = pRuler_Imp->aProtectItem.IsCntntProtected();
+ if( bContentProtected ) return;
+ const long lPos = GetClickPos();
+ if((bRTL && lPos < Min(GetFirstLineIndent(), GetLeftIndent()) && lPos > GetRightIndent()) ||
+ (!bRTL && lPos > Min(GetFirstLineIndent(), GetLeftIndent()) && lPos < GetRightIndent()))
+ {
+ //convert position in left-to-right text
+ long nTabPos;
+ //#i24363# tab stops relative to indent
+ if(bRTL)
+ nTabPos = ( pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset ) ) -
+ lPos;
+ else
+ nTabPos = lPos -
+ ( pRuler_Imp->bIsTabsRelativeToIndent ?
+ GetLeftIndent() :
+ 0 );
+
+ SvxTabStop aTabStop(ConvertHPosLogic(nTabPos),
+ ToAttrTab_Impl(nDefTabType));
+ pTabStopItem->Insert(aTabStop);
+ UpdateTabs();
+ }
+ }
+}
+
+
+sal_Bool SvxRuler::CalcLimits
+(
+ long &nMax1, // zu setzenden Minimalwert
+ long &nMax2, // zu setzenden Maximalwert
+ sal_Bool
+) const
+/*
+ [Beschreibung]
+
+ Defaultimplementierung der virtuellen Funktion; kann die Applikation
+ ueberladen, um eine eigene Grenzwertbehandlung zu implementieren.
+ Die Werte sind auf die Seite bezogen.
+*/
+{
+ nMax1 = LONG_MIN;
+ nMax2 = LONG_MAX;
+ return sal_False;
+}
+
+
+void SvxRuler::CalcMinMax()
+
+/*
+ [Beschreibung]
+
+ Berechnet die Grenzwerte fuers Draggen; diese sind in Pixeln
+ relativ zum Seitenrand
+
+*/
+
+{
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ const long lNullPix = ConvertPosPixel(lLogicNullOffset);
+ pRuler_Imp->lMaxLeftLogic=pRuler_Imp->lMaxRightLogic=-1;
+ switch(GetDragType())
+ {
+ case RULER_TYPE_MARGIN1:
+ { // linker Rand umgebender Frame
+ // DragPos - NOf zwischen links - rechts
+ pRuler_Imp->lMaxLeftLogic = GetLeftMin();
+ nMaxLeft=ConvertSizePixel(pRuler_Imp->lMaxLeftLogic);
+
+ if(!pColumnItem || pColumnItem->Count() == 1 )
+ {
+ if(bRTL)
+ {
+ nMaxRight = lNullPix - GetRightIndent() +
+ Max(GetFirstLineIndent(), GetLeftIndent()) -
+ lMinFrame;
+ }
+ else
+ {
+ nMaxRight = lNullPix + GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent()) -
+ lMinFrame;
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ //top border is not moveable when table rows are displayed
+ // protection of content means the margin is not moveable - it's just a page break inside of a cell
+ if(bHorz && !pRuler_Imp->aProtectItem.IsCntntProtected())
+ {
+ nMaxLeft = pBorders[0].nMinPos + lNullPix;
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ nMaxRight = GetRightIndent() + lNullPix -
+ (pColumnItem->Count() - 1 ) * lMinFrame;
+ else
+ nMaxRight = pBorders[0].nPos - lMinFrame + lNullPix;
+ }
+ else
+ nMaxLeft = nMaxRight = lNullPix;
+ }
+ else
+ {
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ //nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ nMaxRight=lNullPix+CalcPropMaxRight();
+ }
+ else if(nDragType & DRAG_OBJECT_SIZE_LINEAR)
+ {
+ nMaxRight = ConvertPosPixel(
+ GetPageWidth() - (
+ (pColumnItem->IsTable() && pLRSpaceItem)
+ ? pLRSpaceItem->GetRight() : 0))
+ - GetMargin2() + GetMargin1();
+ }
+ else
+ {
+ nMaxRight = lNullPix - lMinFrame;
+ if(pColumnItem->IsFirstAct())
+ {
+ if(bRTL)
+ {
+ nMaxRight += Min(
+ pBorders[0].nPos,
+ Max(GetFirstLineIndent(), GetLeftIndent()) - GetRightIndent());
+ }
+ else
+ {
+ nMaxRight += Min(
+ pBorders[0].nPos, GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent()));
+ }
+ }
+ else if( pColumnItem->Count() > 1 )
+ nMaxRight += pBorders[0].nPos;
+ else
+ nMaxRight +=GetRightIndent() -
+ Max(GetFirstLineIndent(), GetLeftIndent());
+ // den linken Tabellen-Rand nicht ueber den Seitenrand ziehen
+ if(pLRSpaceItem&&pColumnItem->IsTable())
+ {
+ long nTmp=ConvertSizePixel(pLRSpaceItem->GetLeft());
+ if(nTmp>nMaxLeft)
+ nMaxLeft=nTmp;
+ }
+ }
+ }
+ break;
+ }
+ case RULER_TYPE_MARGIN2:
+ { // rechter Rand umgebender Frame
+ pRuler_Imp->lMaxRightLogic =
+ pMinMaxItem ?
+ GetPageWidth() - GetRightMax() : GetPageWidth();
+ nMaxRight = ConvertSizePixel(pRuler_Imp->lMaxRightLogic);
+
+
+ if(!pColumnItem)
+ {
+ if(bRTL)
+ {
+ nMaxLeft = GetMargin2() + GetRightIndent() -
+ Max(GetFirstLineIndent(),GetLeftIndent()) - GetMargin1()+
+ lMinFrame + lNullPix;
+ }
+ else
+ {
+ nMaxLeft = GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),GetLeftIndent()) - GetMargin1()+
+ lMinFrame + lNullPix;
+ }
+ }
+ else if(pRuler_Imp->bIsTableRows)
+ {
+ // get the bottom move range from the last border position - only available for rows!
+ // protection of content means the margin is not moveable - it's just a page break inside of a cell
+ if(bHorz || pRuler_Imp->aProtectItem.IsCntntProtected())
+ {
+ nMaxLeft = nMaxRight = pBorders[pColumnItem->Count() - 1].nMaxPos + lNullPix;
+ }
+ else
+ {
+ if(nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)
+ {
+ nMaxLeft = (pColumnItem->Count()) * lMinFrame + lNullPix;
+ }
+ else
+ {
+ if(pColumnItem->Count() > 1)
+ nMaxLeft = pBorders[pColumnItem->Count() - 2].nPos + lMinFrame + lNullPix;
+ else
+ nMaxLeft = lMinFrame + lNullPix;
+ }
+ if(pColumnItem->Count() > 1)
+ nMaxRight = pBorders[pColumnItem->Count() - 2].nMaxPos + lNullPix;
+ else
+ nMaxRight -= GetRightIndent() - lNullPix;
+ }
+ }
+ else
+ {
+ nMaxLeft = lMinFrame + lNullPix;
+ if(IsActLastColumn() || pColumnItem->Count() < 2 ) //Falls letzte Spalte aktiv
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lMinFrame + lNullPix + GetMargin2() +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxLeft = lMinFrame + lNullPix + GetMargin2() -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ }
+ if( pColumnItem->Count() >= 2 )
+ {
+ long nNewMaxLeft =
+ lMinFrame + lNullPix +
+ pBorders[pColumnItem->Count()-2].nPos +
+ pBorders[pColumnItem->Count()-2].nWidth;
+ nMaxLeft=Max(nMaxLeft,nNewMaxLeft);
+ }
+
+ }
+ break;
+ }
+ case RULER_TYPE_BORDER:
+ { // Tabelle, Spalten (Modifier)
+ const sal_uInt16 nIdx = GetDragAryPos();
+ switch(GetDragSize())
+ {
+ case RULER_DRAGSIZE_1 :
+ {
+ nMaxRight = pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth + lNullPix;
+
+ if(0 == nIdx)
+ nMaxLeft = lNullPix;
+ else
+ nMaxLeft = pBorders[nIdx-1].nPos +
+ pBorders[nIdx-1].nWidth + lNullPix;
+ if(nIdx == pColumnItem->GetActColumn())
+ {
+ if(bRTL)
+ {
+ nMaxLeft += pBorders[nIdx].nPos +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxLeft += pBorders[nIdx].nPos -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ if(0 != nIdx)
+ nMaxLeft -= pBorders[nIdx-1].nPos +
+ pBorders[nIdx-1].nWidth;
+ }
+ nMaxLeft += lMinFrame;
+ nMaxLeft += nDragOffset;
+ break;
+ }
+ case RULER_DRAGSIZE_MOVE:
+ {
+ if(pColumnItem)
+ {
+ //nIdx contains the position of the currently moved item
+ //next visible separator on the left
+ sal_uInt16 nLeftCol=GetActLeftColumn(sal_False, nIdx);
+ //next visible separator on the right
+ sal_uInt16 nRightCol=GetActRightColumn(sal_False, nIdx);
+ //next separator on the left - regardless if visible or not
+ sal_uInt16 nActLeftCol=GetActLeftColumn();
+ //next separator on the right - regardless if visible or not
+ sal_uInt16 nActRightCol=GetActRightColumn();
+ if(pColumnItem->IsTable())
+ {
+ if(nDragType & DRAG_OBJECT_ACTLINE_ONLY)
+ {
+ //the current row/column should be modified only
+ //then the next/previous visible border position
+ //marks the min/max positions
+ nMaxLeft = nLeftCol == USHRT_MAX ?
+ 0 :
+ pBorders[nLeftCol].nPos;
+ //rows can always be increased without a limit
+ if(pRuler_Imp->bIsTableRows)
+ nMaxRight = pBorders[nIdx].nMaxPos;
+ else
+ nMaxRight = nRightCol == USHRT_MAX ?
+ GetMargin2():
+ pBorders[nRightCol].nPos;
+ nMaxLeft += lNullPix;
+ nMaxRight += lNullPix;
+ }
+ else
+ {
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType && !bHorz && pRuler_Imp->bIsTableRows)
+ nMaxLeft = (nIdx + 1) * lMinFrame + lNullPix;
+ else
+ nMaxLeft = pBorders[nIdx].nMinPos + lNullPix;
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType||
+ (DRAG_OBJECT_SIZE_LINEAR & nDragType) )
+ {
+ if(pRuler_Imp->bIsTableRows)
+ {
+ if(bHorz)
+ nMaxRight = GetRightIndent() + lNullPix -
+ (pColumnItem->Count() - nIdx - 1) * lMinFrame;
+ else
+ nMaxRight = pBorders[nIdx].nMaxPos + lNullPix;
+ }
+ else
+ nMaxRight=lNullPix+CalcPropMaxRight(nIdx);
+ }
+ else
+ nMaxRight = pBorders[nIdx].nMaxPos + lNullPix;
+ }
+ nMaxLeft += lMinFrame;
+ nMaxRight -= lMinFrame;
+
+ }
+ else
+ {
+ if(nLeftCol==USHRT_MAX)
+ nMaxLeft=lNullPix;
+ else
+ nMaxLeft = pBorders[nLeftCol].nPos +
+ pBorders[nLeftCol].nWidth + lNullPix;
+
+ if(nActRightCol == nIdx)
+ {
+ if(bRTL)
+ {
+ nMaxLeft += pBorders[nIdx].nPos +
+ GetRightIndent() - Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ if(nActLeftCol!=USHRT_MAX)
+ nMaxLeft -= pBorders[nActLeftCol].nPos +
+ pBorders[nActLeftCol].nWidth;
+ }
+ else
+ {
+ nMaxLeft += pBorders[nIdx].nPos -
+ GetRightIndent() + Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ if(nActLeftCol!=USHRT_MAX)
+ nMaxLeft -= pBorders[nActLeftCol].nPos +
+ pBorders[nActLeftCol].nWidth;
+ }
+ }
+ nMaxLeft += lMinFrame;
+ nMaxLeft += nDragOffset;
+
+ // nMaxRight
+ // linear / proprotional verschieben
+ if(DRAG_OBJECT_SIZE_PROPORTIONAL & nDragType||
+ (DRAG_OBJECT_SIZE_LINEAR & nDragType) )
+ {
+ nMaxRight=lNullPix+CalcPropMaxRight(nIdx);
+ }
+ else if(DRAG_OBJECT_SIZE_LINEAR & nDragType)
+ {
+ nMaxRight=lNullPix+GetMargin2()-GetMargin1()+
+ (nBorderCount-nIdx-1)*lMinFrame;
+ }
+ else
+ {
+ if(nRightCol==USHRT_MAX)
+ { // letzte Spalte
+ nMaxRight = GetMargin2() + lNullPix;
+ if(IsActLastColumn())
+ {
+ if(bRTL)
+ {
+ nMaxRight -=
+ GetMargin2() + GetRightIndent() -
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxRight -=
+ GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ else
+ {
+ nMaxRight = lNullPix + pBorders[nRightCol].nPos;
+ sal_uInt16 nNotHiddenRightCol =
+ GetActRightColumn(sal_True, nIdx);
+
+ if( nActLeftCol == nIdx )
+ {
+ long nBorder = nNotHiddenRightCol ==
+ USHRT_MAX ?
+ GetMargin2() :
+ pBorders[nNotHiddenRightCol].nPos;
+ if(bRTL)
+ {
+ nMaxRight -= nBorder + GetRightIndent() -
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ else
+ {
+ nMaxRight -= nBorder - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ }
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ nMaxRight -= lMinFrame;
+ nMaxRight -= pBorders[nIdx].nWidth;
+ }
+ }
+ }
+ // ObjectItem
+ else
+ {
+ if(pObjectItem->HasLimits())
+ {
+ if(CalcLimits(nMaxLeft, nMaxRight, nIdx & 1? sal_False : sal_True))
+ {
+ nMaxLeft = ConvertPosPixel(nMaxLeft);
+ nMaxRight = ConvertPosPixel(nMaxRight);
+ }
+ }
+ else
+ {
+ nMaxLeft = LONG_MIN;
+ nMaxRight = LONG_MAX;
+ }
+ }
+ break;
+ }
+ case RULER_DRAGSIZE_2:
+ {
+ nMaxLeft = lNullPix + pBorders[nIdx].nPos;
+ if(nIdx == pColumnItem->Count()-2) { // letzte Spalte
+ nMaxRight = GetMargin2() + lNullPix;
+ if(pColumnItem->IsLastAct()) {
+ nMaxRight -=
+ GetMargin2() - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ else {
+ nMaxRight = lNullPix + pBorders[nIdx+1].nPos;
+ if(pColumnItem->GetActColumn()-1 == nIdx) {
+ nMaxRight -= pBorders[nIdx+1].nPos - GetRightIndent() +
+ Max(GetFirstLineIndent(),
+ GetLeftIndent());
+ nMaxRight += pBorders[nIdx].nPos +
+ pBorders[nIdx].nWidth;
+ }
+ }
+ nMaxRight -= lMinFrame;
+ nMaxRight -= pBorders[nIdx].nWidth;
+ break;
+ }
+ }
+ nMaxRight += nDragOffset;
+ break;
+ }
+ case RULER_TYPE_INDENT:
+ {
+ const sal_uInt16 nIdx = GetDragAryPos();
+ switch(nIdx) {
+ case INDENT_FIRST_LINE - INDENT_GAP:
+ case INDENT_LEFT_MARGIN - INDENT_GAP:
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lNullPix + GetRightIndent();
+
+ if(pColumnItem && !pColumnItem->IsFirstAct())
+ nMaxLeft += pBorders[pColumnItem->GetActColumn()-1].nPos +
+ pBorders[pColumnItem->GetActColumn()-1].nWidth;
+ nMaxRight = lNullPix + GetMargin2();
+
+ // zusammem draggen
+ if((INDENT_FIRST_LINE - INDENT_GAP) != nIdx &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ {
+ if(GetLeftIndent() > GetFirstLineIndent())
+ nMaxLeft += GetLeftIndent() - GetFirstLineIndent();
+ else
+ nMaxRight -= GetFirstLineIndent() - GetLeftIndent();
+ }
+ }
+ else
+ {
+ nMaxLeft = lNullPix;
+
+ if(pColumnItem && !pColumnItem->IsFirstAct())
+ nMaxLeft += pBorders[pColumnItem->GetActColumn()-1].nPos +
+ pBorders[pColumnItem->GetActColumn()-1].nWidth;
+ nMaxRight = lNullPix + GetRightIndent() - lMinFrame;
+
+ // zusammem draggen
+ if((INDENT_FIRST_LINE - INDENT_GAP) != nIdx &&
+ (nDragType & DRAG_OBJECT_LEFT_INDENT_ONLY) !=
+ DRAG_OBJECT_LEFT_INDENT_ONLY)
+ {
+ if(GetLeftIndent() > GetFirstLineIndent())
+ nMaxLeft += GetLeftIndent() - GetFirstLineIndent();
+ else
+ nMaxRight -= GetFirstLineIndent() - GetLeftIndent();
+ }
+ }
+ }
+ break;
+ case INDENT_RIGHT_MARGIN - INDENT_GAP:
+ {
+ if(bRTL)
+ {
+ nMaxLeft = lNullPix;
+ nMaxRight = lNullPix + Min(GetFirstLineIndent(), GetLeftIndent()) - lMinFrame;
+ if(pColumnItem)
+ {
+ sal_uInt16 nRightCol=GetActRightColumn( sal_True );
+ if(!IsActLastColumn( sal_True ))
+ nMaxRight += pBorders[nRightCol].nPos;
+ else
+ nMaxRight += GetMargin2();
+ }
+ else
+ nMaxLeft += GetMargin1();
+ nMaxLeft += lMinFrame;
+ }
+ else
+ {
+ nMaxLeft = lNullPix +
+ Max(GetFirstLineIndent(), GetLeftIndent());
+ nMaxRight = lNullPix;
+ if(pColumnItem)
+ {
+ sal_uInt16 nRightCol=GetActRightColumn( sal_True );
+ if(!IsActLastColumn( sal_True ))
+ nMaxRight += pBorders[nRightCol].nPos;
+ else
+ nMaxRight += GetMargin2();
+ }
+ else
+ nMaxRight += GetMargin2();
+ nMaxLeft += lMinFrame;
+ }
+ }
+ break;
+ }
+ break;
+ }
+ case RULER_TYPE_TAB: // Tabs (Modifier)
+ /*
+ links = NOf + Max(LAR, EZ)
+ rechts = NOf + RAR
+ */
+ nMaxLeft = bRTL ? lNullPix + GetRightIndent()
+ : lNullPix + Min(GetFirstLineIndent(), GetLeftIndent());
+ pRuler_Imp->lMaxRightLogic=GetLogicRightIndent()+lLogicNullOffset;
+ nMaxRight = ConvertSizePixel(pRuler_Imp->lMaxRightLogic);
+ break;
+ default: ; //prevent warning
+ }
+#ifdef DEBUGLIN
+ {
+ String aStr("MinLeft: ");
+ Size aSize(nMaxLeft + lNullPix, 0);
+ Size aSize2(nMaxRight + lNullPix, 0);
+ aSize = pEditWin->PixelToLogic(aSize, MapMode(MAP_MM));
+ aSize2 = pEditWin->PixelToLogic(aSize2, MapMode(MAP_MM));
+ aStr += String(aSize.Width());
+ aStr += " MaxRight: ";
+ aStr += String(aSize2.Width());
+ InfoBox(0, aStr).Execute();
+ }
+#endif
+}
+
+
+long __EXPORT SvxRuler::StartDrag()
+
+/*
+ [Beschreibung]
+
+ Beginn eines Drag-Vorgangs (SV-Handler); wertet Modifier aus
+ und berechnet Grenzwerte
+
+ [Querverweise]
+
+ <SvxRuler::EvalModifier()>
+ <SvxRuler::CalcMinMax()>
+ <SvxRuler::EndDrag()>
+
+*/
+
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/StartDrag"));
+ sal_Bool bContentProtected = pRuler_Imp->aProtectItem.IsCntntProtected();
+ if(!bValid)
+ return sal_False;
+
+ pRuler_Imp->lLastLMargin=GetMargin1();
+ pRuler_Imp->lLastRMargin=GetMargin2();
+ long bOk = 1;
+ if(GetStartDragHdl().IsSet())
+ bOk = Ruler::StartDrag();
+ if(bOk) {
+ lInitialDragPos = GetDragPos();
+ switch(GetDragType()) {
+ case RULER_TYPE_MARGIN1: // linker Rand umgebender Frame
+ case RULER_TYPE_MARGIN2: // rechter Rand umgebender Frame
+ if((bHorz && pLRSpaceItem) || (!bHorz && pULSpaceItem))
+ {
+ if(pColumnItem)
+ EvalModifier();
+ else
+ nDragType = DRAG_OBJECT;
+ }
+ else
+ bOk = sal_False;
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten (Modifier)
+ if(pColumnItem)
+ {
+ nDragOffset = pColumnItem->IsTable()? 0 :
+ GetDragPos() - pBorders[GetDragAryPos()].nPos;
+ EvalModifier();
+
+ }
+ else
+ nDragOffset = 0;
+ break;
+ case RULER_TYPE_INDENT: { // Absatzeinzuege (Modifier)
+ if( bContentProtected )
+ return sal_False;
+ sal_uInt16 nIndent = INDENT_LEFT_MARGIN;
+ if((nIndent) == GetDragAryPos() + INDENT_GAP) { // Linker Absatzeinzug
+ pIndents[0] = pIndents[INDENT_FIRST_LINE];
+ pIndents[0].nStyle |= RULER_STYLE_DONTKNOW;
+ EvalModifier();
+ }
+ else
+ nDragType = DRAG_OBJECT;
+ pIndents[1] = pIndents[GetDragAryPos()+INDENT_GAP];
+ pIndents[1].nStyle |= RULER_STYLE_DONTKNOW;
+ break;
+ }
+ case RULER_TYPE_TAB: // Tabs (Modifier)
+ if( bContentProtected ) return sal_False;
+ EvalModifier();
+ pTabs[0] = pTabs[GetDragAryPos()+1];
+ pTabs[0].nStyle |= RULER_STYLE_DONTKNOW;
+ break;
+ default:
+ nDragType = NONE;
+ }
+ }
+ else
+ nDragType = NONE;
+ if(bOk)
+ CalcMinMax();
+ return bOk;
+}
+
+
+void __EXPORT SvxRuler::Drag()
+/*
+ [Beschreibung]
+
+ SV-Draghandler
+
+*/
+{
+ if(IsDragCanceled())
+ {
+ Ruler::Drag();
+ return;
+ }
+ switch(GetDragType()) {
+ case RULER_TYPE_MARGIN1: // linker Rand umgebender Frame
+ DragMargin1();
+ pRuler_Imp->lLastLMargin=GetMargin1();
+ break;
+ case RULER_TYPE_MARGIN2: // rechter Rand umgebender Frame
+ DragMargin2();
+ pRuler_Imp->lLastRMargin = GetMargin2();
+ break;
+ case RULER_TYPE_INDENT: // Absatzeinzuege
+ DragIndents();
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten
+ if(pColumnItem)
+ DragBorders();
+ else if(pObjectItem)
+ DragObjectBorder();
+ break;
+ case RULER_TYPE_TAB: // Tabs
+ DragTabs();
+ break;
+ default: ;//prevent warning
+ }
+ Ruler::Drag();
+}
+
+
+void __EXPORT SvxRuler::EndDrag()
+/*
+ [Beschreibung]
+
+ SV-Handler; wird beim Beenden des Draggens gerufen.
+ Stoesst die Aktualisierung der Daten der Applikation an, indem
+ durch Aufruf der jeweiligen Apply...()- Methoden die Daten an die
+ Applikation geschickt werden.
+
+*/
+{
+ lcl_logRulerUse(::rtl::OUString::createFromAscii(".special://SfxRuler/EndDrag"));
+ const sal_Bool bUndo = IsDragCanceled();
+ const long lPos = GetDragPos();
+ DrawLine_Impl(lTabPos, 6, bHorz);
+ lTabPos=-1;
+ if(!bUndo)
+ switch(GetDragType())
+ {
+ case RULER_TYPE_MARGIN1: // linker, oberer Rand umgebender Frame
+ case RULER_TYPE_MARGIN2: // rechter, unterer Rand umgebender Frame
+ {
+ if(!pColumnItem || !pColumnItem->IsTable())
+ ApplyMargins();
+
+ if(pColumnItem &&
+ (pColumnItem->IsTable() ||
+ (nDragType & DRAG_OBJECT_SIZE_PROPORTIONAL)))
+ ApplyBorders();
+
+ }
+ break;
+ case RULER_TYPE_BORDER: // Tabelle, Spalten
+ if(lInitialDragPos != lPos ||
+ (pRuler_Imp->bIsTableRows && bHorz)) //special case - the null offset is changed here
+ {
+ if(pColumnItem)
+ {
+ ApplyBorders();
+ if(bHorz)
+ UpdateTabs();
+ }
+ else if(pObjectItem)
+ ApplyObject();
+ }
+ break;
+ case RULER_TYPE_INDENT: // Absatzeinzuege
+ if(lInitialDragPos != lPos)
+ ApplyIndents();
+ SetIndents(INDENT_COUNT, pIndents+INDENT_GAP);
+ break;
+ case RULER_TYPE_TAB: // Tabs
+ {
+ ApplyTabs();
+ pTabs[GetDragAryPos()].nStyle &= ~RULER_STYLE_INVISIBLE;
+ SetTabs(nTabCount, pTabs+TAB_GAP);
+ }
+ break;
+ default: ; //prevent warning
+ }
+ nDragType = NONE;
+ Ruler::EndDrag();
+ if(bUndo)
+ for(sal_uInt16 i=0;i<pRuler_Imp->nControlerItems;i++)
+ {
+ pCtrlItem[i]->ClearCache();
+ pCtrlItem[i]->GetBindings().Invalidate(pCtrlItem[i]->GetId());
+ // pCtrlItem[i]->UnBind();
+// pCtrlItem[i]->ReBind();
+ }
+}
+
+
+void __EXPORT SvxRuler::ExtraDown()
+
+/*
+ [Beschreibung]
+
+ Ueberladene SV-Methode; setzt den neuen Typ fuer den Defaulttabulator.
+*/
+
+{
+ // Tabulator Typ umschalten
+ if(pTabStopItem &&
+ (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS) {
+ ++nDefTabType;
+ if(RULER_TAB_DEFAULT == nDefTabType)
+ nDefTabType = RULER_TAB_LEFT;
+ SetExtraType(RULER_EXTRA_TAB, nDefTabType);
+ }
+ Ruler::ExtraDown();
+}
+
+
+void __EXPORT SvxRuler::Notify(SfxBroadcaster&, const SfxHint& rHint)
+/*
+
+ [Beschreibung]
+
+ Benachrichtigung durch die Bindings, dass die Statusaktualisierung
+ beendet ist.
+ Das Lineal aktualisiert seine Darstellung und meldet sich bei den
+ Bindings wieder ab.
+
+*/
+
+{
+ // Aktualisierung anstossen
+ if(bActive &&
+ rHint.Type() == TYPE(SfxSimpleHint) &&
+ ((SfxSimpleHint&) rHint ).GetId() == SFX_HINT_UPDATEDONE ) {
+ Update();
+ EndListening(*pBindings);
+ bValid = sal_True;
+ bListening = sal_False;
+ }
+}
+
+
+IMPL_LINK_INLINE_START( SvxRuler, MenuSelect, Menu *, pMenu )
+
+/*
+ [Beschreibung]
+
+ Handler des Kontextmenues fuer das Umschalten der Masseinheit
+
+*/
+
+{
+ SetUnit(FieldUnit(pMenu->GetCurItemId()));
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvxRuler, MenuSelect, Menu *, pMenu )
+
+
+IMPL_LINK( SvxRuler, TabMenuSelect, Menu *, pMenu )
+
+/*
+ [Beschreibung]
+
+ Handler des Tabulatormenues fuer das Setzen des Typs
+
+*/
+
+{
+ if(pTabStopItem && pTabStopItem->Count() > pRuler_Imp->nIdx)
+ {
+ SvxTabStop aTabStop = (*pTabStopItem)[pRuler_Imp->nIdx];
+ aTabStop.GetAdjustment() = ToAttrTab_Impl(pMenu->GetCurItemId()-1);
+ pTabStopItem->Remove(pRuler_Imp->nIdx);
+ pTabStopItem->Insert(aTabStop);
+ sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL;
+ pBindings->GetDispatcher()->Execute( nTabStopId, SFX_CALLMODE_RECORD, pTabStopItem, 0L );
+ UpdateTabs();
+ pRuler_Imp->nIdx = 0;
+ }
+ return 0;
+}
+
+
+void SvxRuler::Command( const CommandEvent& rCEvt )
+
+/*
+ [Beschreibung]
+
+ Mauskontextmenue fuer das Umschalten der Masseinheit
+
+*/
+
+{
+ if ( COMMAND_CONTEXTMENU == rCEvt.GetCommand() )
+ {
+ CancelDrag();
+ sal_Bool bRTL = pRuler_Imp->pTextRTLItem && pRuler_Imp->pTextRTLItem->GetValue();
+ if ( pTabs &&
+ RULER_TYPE_TAB ==
+ GetType( rCEvt.GetMousePosPixel(), &pRuler_Imp->nIdx ) &&
+ pTabs[pRuler_Imp->nIdx+TAB_GAP].nStyle < RULER_TAB_DEFAULT )
+ {
+ PopupMenu aMenu;
+ aMenu.SetSelectHdl(LINK(this, SvxRuler, TabMenuSelect));
+ VirtualDevice aDev;
+ const Size aSz(RULER_TAB_WIDTH+2, RULER_TAB_HEIGHT+2);
+ aDev.SetOutputSize(aSz);
+ aDev.SetBackground(Wallpaper(Color(COL_WHITE)));
+ const Point aPt(aSz.Width() / 2, aSz.Height() / 2);
+
+ for ( sal_uInt16 i = RULER_TAB_LEFT; i < RULER_TAB_DEFAULT; ++i )
+ {
+ sal_uInt16 nStyle = bRTL ? i|RULER_TAB_RTL : i;
+ nStyle |= (sal_uInt16)(bHorz ? WB_HORZ : WB_VERT);
+ DrawTab(&aDev, aPt, nStyle);
+ aMenu.InsertItem(i+1,
+ String(ResId(RID_SVXSTR_RULER_START+i, DIALOG_MGR())),
+ Image(aDev.GetBitmap(Point(), aSz), Color(COL_WHITE)));
+ aMenu.CheckItem(i+1, i == pTabs[pRuler_Imp->nIdx+TAB_GAP].nStyle);
+ aDev.SetOutputSize(aSz); // device loeschen
+ }
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ else
+ {
+ PopupMenu aMenu(ResId(RID_SVXMN_RULER, DIALOG_MGR()));
+ aMenu.SetSelectHdl(LINK(this, SvxRuler, MenuSelect));
+ FieldUnit eUnit = GetUnit();
+ const sal_uInt16 nCount = aMenu.GetItemCount();
+
+ sal_Bool bReduceMetric = 0 != (nFlags &SVXRULER_SUPPORT_REDUCED_METRIC);
+ for ( sal_uInt16 i = nCount; i; --i )
+ {
+ const sal_uInt16 nId = aMenu.GetItemId(i - 1);
+ aMenu.CheckItem(nId, nId == (sal_uInt16)eUnit);
+ if(bReduceMetric &&
+ (nId == FUNIT_M ||
+ nId == FUNIT_KM ||
+ nId == FUNIT_FOOT ||
+ nId == FUNIT_MILE ))
+ aMenu.RemoveItem(i - 1);
+ }
+ aMenu.Execute( this, rCEvt.GetMousePosPixel() );
+ }
+ }
+ else
+ Ruler::Command( rCEvt );
+}
+
+
+sal_uInt16 SvxRuler::GetActRightColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct ) const
+{
+ if( nAct == USHRT_MAX )
+ nAct = pColumnItem->GetActColumn();
+ else nAct++; //Damit man die ActDrag uebergeben kann
+
+ sal_Bool bConsiderHidden = !bForceDontConsiderHidden &&
+ !( nDragType & DRAG_OBJECT_ACTLINE_ONLY );
+
+ while( nAct < pColumnItem->Count() - 1 )
+ {
+ if( (*pColumnItem)[nAct].bVisible || bConsiderHidden )
+ return nAct;
+ else
+ nAct++;
+ }
+ return USHRT_MAX;
+}
+
+
+
+sal_uInt16 SvxRuler::GetActLeftColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct ) const
+{
+ if(nAct==USHRT_MAX)
+ nAct=pColumnItem->GetActColumn();
+
+ sal_uInt16 nLOffs=1;
+
+ sal_Bool bConsiderHidden = !bForceDontConsiderHidden &&
+ !( nDragType & DRAG_OBJECT_ACTLINE_ONLY );
+
+ while(nAct>=nLOffs)
+ {
+ if( (*pColumnItem)[ nAct - nLOffs ].bVisible || bConsiderHidden )
+ return nAct-nLOffs;
+ else
+ nLOffs++;
+ }
+ return USHRT_MAX;
+}
+
+
+sal_Bool SvxRuler::IsActLastColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct) const
+{
+ return GetActRightColumn(bForceDontConsiderHidden, nAct)==USHRT_MAX;
+}
+
+sal_Bool SvxRuler::IsActFirstColumn(
+ sal_Bool bForceDontConsiderHidden, sal_uInt16 nAct) const
+{
+ return GetActLeftColumn(bForceDontConsiderHidden, nAct)==USHRT_MAX;
+}
+
+long SvxRuler::CalcPropMaxRight(sal_uInt16 nCol) const
+{
+
+ if(!(nDragType & DRAG_OBJECT_SIZE_LINEAR))
+ {
+
+ // ausgehend vom rechten Rand die Mindestbreiten
+ // aller betroffenen Spalten abziehen
+ long _nMaxRight = GetMargin2()-GetMargin1();
+
+ long lFences=0;
+ long lMinSpace=USHRT_MAX;
+ long lOldPos;
+ long lColumns=0;
+ sal_uInt16 nStart;
+ if(!pColumnItem->IsTable())
+ {
+ if(nCol==USHRT_MAX)
+ {
+ lOldPos=GetMargin1();
+ nStart=0;
+ }
+ else
+ {
+ lOldPos=pBorders[nCol].nPos+pBorders[nCol].nWidth;
+ nStart=nCol+1;
+ lFences=pBorders[nCol].nWidth;
+ }
+
+ for(sal_uInt16 i = nStart; i < nBorderCount-1; ++i)
+ {
+ long lWidth=pBorders[i].nPos-lOldPos;
+ lColumns+=lWidth;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ lOldPos=pBorders[i].nPos+pBorders[i].nWidth;
+ lFences+=pBorders[i].nWidth;
+ }
+ long lWidth=GetMargin2()-lOldPos;
+ lColumns+=lWidth;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ }
+ else
+ {
+ sal_uInt16 nActCol;
+ if(nCol==USHRT_MAX) //CalcMinMax fuer LeftMargin
+ {
+ lOldPos=GetMargin1();
+ }
+ else
+ {
+ lOldPos=pBorders[nCol].nPos;
+ }
+ lColumns=GetMargin2()-lOldPos;
+ nActCol=nCol;
+ lFences=0;
+ while(nActCol<nBorderCount||nActCol==USHRT_MAX)
+ {
+ sal_uInt16 nRight;
+ if(nActCol==USHRT_MAX)
+ {
+ nRight=0;
+ while(!(*pColumnItem)[nRight].bVisible)
+ nRight++;
+ }
+ else
+ nRight=GetActRightColumn(sal_False, nActCol);
+ long lWidth;
+ if(nRight!=USHRT_MAX)
+ {
+ lWidth=pBorders[nRight].nPos-lOldPos;
+ lOldPos=pBorders[nRight].nPos;
+ }
+ else
+ lWidth=GetMargin2()-lOldPos;
+ nActCol=nRight;
+ if(lWidth<lMinSpace)
+ lMinSpace=lWidth;
+ if(nActCol==USHRT_MAX)
+ break;
+ }
+ }
+
+ _nMaxRight-=(long)(lFences+lMinFrame/(float)lMinSpace*lColumns);
+ return _nMaxRight;
+ }
+ else
+ {
+ if(pColumnItem->IsTable())
+ {
+ sal_uInt16 nVisCols=0;
+ for(sal_uInt16 i=GetActRightColumn(sal_False, nCol);i<nBorderCount;)
+ {
+ if((*pColumnItem)[i].bVisible)
+ nVisCols++;
+ i=GetActRightColumn(sal_False, i);
+ }
+ return GetMargin2()-GetMargin1()-(nVisCols+1)*lMinFrame;
+ }
+ else
+ {
+ long lWidth=0;
+ for(sal_uInt16 i=nCol;i<nBorderCount-1;i++)
+ {
+ lWidth+=lMinFrame+pBorders[i].nWidth;
+ }
+ return GetMargin2()-GetMargin1()-lWidth;
+ }
+ }
+}
+/*-- 29.11.2007 08:24:23---------------------------------------------------
+ //#i24363# tab stops relative to indent
+ -----------------------------------------------------------------------*/
+void SvxRuler::SetTabsRelativeToIndent( sal_Bool bRel )
+{
+ pRuler_Imp->bIsTabsRelativeToIndent = bRel;
+}
+
diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx
new file mode 100644
index 000000000000..b030a27c952a
--- /dev/null
+++ b/svx/source/dialog/swframeexample.cxx
@@ -0,0 +1,737 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+
+#include <tools/poly.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/svapp.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svx/swframeexample.hxx>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+
+using namespace ::com::sun::star::text;
+
+#define FLYINFLY_BORDER 3
+#define DEMOTEXT "Ij"
+#define C2S(cChar) UniString::CreateFromAscii(cChar)
+
+
+SvxSwFrameExample::SvxSwFrameExample( Window *pParent, const ResId& rResID ) :
+
+ Window(pParent, rResID),
+
+ nHAlign (HoriOrientation::CENTER),
+ nHRel (RelOrientation::FRAME),
+ nVAlign (VertOrientation::TOP),
+ nVRel (RelOrientation::PRINT_AREA),
+ nWrap (WrapTextMode_NONE),
+ nAnchor (TextContentAnchorType_AT_PAGE),
+ bTrans (sal_False),
+ aRelPos (Point(0,0))
+{
+ InitColors_Impl();
+ SetMapMode(MAP_PIXEL);
+}
+
+SvxSwFrameExample::~SvxSwFrameExample()
+{
+}
+
+void SvxSwFrameExample::InitColors_Impl( void )
+{
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ m_aBgCol = Color( rSettings.GetWindowColor() ); // old: COL_WHITE
+
+ sal_Bool bHC = rSettings.GetHighContrastMode();
+
+ m_aFrameColor = Color( COL_LIGHTGREEN );
+ m_aAlignColor = Color( COL_LIGHTRED );
+ m_aTransColor = Color( COL_TRANSPARENT );
+
+ m_aTxtCol = bHC?
+ svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR).nColor :
+ Color( COL_GRAY ); // old: COL_GRAY
+ m_aPrintAreaCol = bHC? m_aTxtCol : Color( COL_GRAY );
+ m_aBorderCol = m_aTxtCol; // old: COL_BLACK;
+ m_aBlankCol = bHC? m_aTxtCol : Color( COL_LIGHTGRAY );
+ m_aBlankFrameCol = bHC? m_aTxtCol : Color( COL_GRAY );
+}
+
+void SvxSwFrameExample::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitColors_Impl();
+}
+
+void SvxSwFrameExample::InitAllRects_Impl()
+{
+// const Size aSz(GetOutputSizePixel());
+
+ // Seite
+// aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
+ aPage.SetSize( GetOutputSizePixel() );
+
+ sal_uIntPtr nOutWPix = aPage.GetWidth();
+ sal_uIntPtr nOutHPix = aPage.GetHeight();
+
+ // PrintArea
+ sal_uIntPtr nLBorder;
+ sal_uIntPtr nRBorder;
+ sal_uIntPtr nTBorder;
+ sal_uIntPtr nBBorder;
+
+ sal_uIntPtr nLTxtBorder;
+ sal_uIntPtr nRTxtBorder;
+ sal_uIntPtr nTTxtBorder;
+ sal_uIntPtr nBTxtBorder;
+
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ nLBorder = 14;
+ nRBorder = 10;
+ nTBorder = 10;
+ nBBorder = 15;
+
+ nLTxtBorder = 8;
+ nRTxtBorder = 4;
+ nTTxtBorder = 2;
+ nBTxtBorder = 2;
+ }
+ else
+ {
+ nLBorder = 2;
+ nRBorder = 2;
+ nTBorder = 2;
+ nBBorder = 2;
+
+ nLTxtBorder = 2;
+ nRTxtBorder = 2;
+ nTTxtBorder = 2;
+ nBTxtBorder = 2;
+ }
+ aPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
+
+ // Beispiel-Text: Vorbereiten fuer die Textausgabe
+ // Eine Textzeile
+ aTextLine = aPagePrtArea;
+ aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
+ aTextLine.Left() += nLTxtBorder;
+ aTextLine.Right() -= nRTxtBorder;
+ aTextLine.Move(0, nTTxtBorder);
+
+ // Rechteck um Absatz incl. Raender
+ sal_uInt16 nLines = (sal_uInt16)((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder)
+ / (aTextLine.GetHeight() + 2));
+ aPara = aPagePrtArea;
+ aPara.SetSize(Size(aPara.GetWidth(),
+ (aTextLine.GetHeight() + 2) * nLines + nTTxtBorder + nBTxtBorder));
+
+ // Rechteck um Absatz ohne Raender
+ aParaPrtArea = aPara;
+ aParaPrtArea.Left() += nLTxtBorder;
+ aParaPrtArea.Right() -= nRTxtBorder;
+ aParaPrtArea.Top() += nTTxtBorder;
+ aParaPrtArea.Bottom() -= nBTxtBorder;
+
+ if (nAnchor == TextContentAnchorType_AS_CHARACTER || nAnchor == TextContentAnchorType_AT_CHARACTER)
+ {
+ Font aFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_LATIN_TEXT, Application::GetSettings().GetLanguage(),
+ DEFAULTFONT_FLAGS_ONLYONE, this );
+ aFont.SetColor( m_aTxtCol );
+ aFont.SetFillColor( m_aBgCol );
+ aFont.SetWeight(WEIGHT_NORMAL);
+
+ if (nAnchor == TextContentAnchorType_AS_CHARACTER)
+ {
+ aFont.SetSize(Size(0, aParaPrtArea.GetHeight() - 2));
+ SetFont(aFont);
+ aParaPrtArea.SetSize(Size(GetTextWidth(C2S(DEMOTEXT)), GetTextHeight()));
+ }
+ else
+ {
+ aFont.SetSize(Size(0, aParaPrtArea.GetHeight() / 2));
+ SetFont(aFont);
+ aAutoCharFrame.SetSize(Size(GetTextWidth('A'), GetTextHeight()));
+ aAutoCharFrame.SetPos(Point(aParaPrtArea.Left() + (aParaPrtArea.GetWidth() - aAutoCharFrame.GetWidth()) / 2,
+ aParaPrtArea.Top() + (aParaPrtArea.GetHeight() - aAutoCharFrame.GetHeight()) / 2));
+ }
+ }
+
+ // Innerer Frame fuer am Frame verankerte Rahmen
+ aFrameAtFrame = aPara;
+ aFrameAtFrame.Left() += 9;
+ aFrameAtFrame.Right() -= 5;
+ aFrameAtFrame.Bottom() += 5;
+ aFrameAtFrame.SetPos(Point(aFrameAtFrame.Left() + 2, (aPagePrtArea.Bottom() - aFrameAtFrame.GetHeight()) / 2 + 5));
+
+ // Groesse des zu positionierenden Rahmens
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ sal_uIntPtr nLFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nLBorder : nLTxtBorder;
+ sal_uIntPtr nRFBorder = nAnchor == TextContentAnchorType_AT_PAGE ? nRBorder : nRTxtBorder;
+
+ switch (nHRel)
+ {
+ case RelOrientation::PAGE_LEFT:
+ case RelOrientation::FRAME_LEFT:
+ aFrmSize = Size(nLFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ case RelOrientation::FRAME_RIGHT:
+ aFrmSize = Size(nRFBorder - 4, (aTextLine.GetHeight() + 2) * 3);
+ break;
+
+ default:
+ aFrmSize = Size(nLBorder - 3, (aTextLine.GetHeight() + 2) * 3);
+ break;
+ }
+ aFrmSize.Width() = Max(5L, aFrmSize.Width());
+ aFrmSize.Height() = Max(5L, aFrmSize.Height());
+ }
+ else
+ {
+ sal_uIntPtr nFreeWidth = aPagePrtArea.GetWidth() - GetTextWidth(C2S(DEMOTEXT));
+
+ aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3);
+ aDrawObj.SetSize(Size(Max(5L, (long)nFreeWidth / 3L), Max(5L, aFrmSize.Height() * 3L)));
+ aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2));
+ aParaPrtArea.Right() = aDrawObj.Right();
+ }
+}
+
+void SvxSwFrameExample::CalcBoundRect_Impl(Rectangle &rRect)
+{
+ switch (nAnchor)
+ {
+ case TextContentAnchorType_AT_PAGE:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aPagePrtArea.Left();
+ rRect.Right() = aPagePrtArea.Right();
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPagePrtArea.Left();
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aPagePrtArea.Right();
+ rRect.Right() = aPage.Right();
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Top() = aPagePrtArea.Top();
+ rRect.Bottom() = aPagePrtArea.Bottom();
+ break;
+
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Top() = aPage.Top();
+ rRect.Bottom() = aPage.Bottom();
+ break;
+ }
+ }
+ break;
+
+ case TextContentAnchorType_AT_FRAME:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aFrameAtFrame.Left();
+ rRect.Right() = aFrameAtFrame.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aFrameAtFrame.Left();
+ rRect.Right() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aFrameAtFrame.Right();
+ rRect.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::FRAME:
+ case RelOrientation::PAGE_FRAME:
+ rRect.Top() = aFrameAtFrame.Top();
+ rRect.Bottom() = aFrameAtFrame.Bottom();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
+ rRect.Bottom() = aFrameAtFrame.Bottom() - FLYINFLY_BORDER;
+ break;
+ }
+ }
+ break;
+ case TextContentAnchorType_AT_PARAGRAPH:
+ case TextContentAnchorType_AT_CHARACTER:
+ {
+ switch (nHRel)
+ {
+ case RelOrientation::FRAME:
+ rRect.Left() = aPara.Left();
+ rRect.Right() = aPara.Right();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ rRect.Left() = aParaPrtArea.Left();
+ rRect.Right() = aParaPrtArea.Right();
+ break;
+
+ case RelOrientation::PAGE_LEFT:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPagePrtArea.Left();
+ break;
+
+ case RelOrientation::PAGE_RIGHT:
+ rRect.Left() = aPagePrtArea.Right();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PAGE_FRAME:
+ rRect.Left() = aPage.Left();
+ rRect.Right() = aPage.Right();
+ break;
+
+ case RelOrientation::PAGE_PRINT_AREA:
+ rRect.Left() = aPagePrtArea.Left();
+ rRect.Right() = aPagePrtArea.Right();
+ break;
+
+ case RelOrientation::FRAME_LEFT:
+ rRect.Left() = aPara.Left();
+ rRect.Right() = aParaPrtArea.Left();
+ break;
+
+ case RelOrientation::FRAME_RIGHT:
+ rRect.Left() = aParaPrtArea.Right();
+ rRect.Right() = aPara.Right();
+ break;
+
+ case RelOrientation::CHAR:
+ rRect.Left() = aAutoCharFrame.Left();
+ rRect.Right() = aAutoCharFrame.Left();
+ break;
+ }
+
+ switch (nVRel)
+ {
+ case RelOrientation::FRAME:
+ rRect.Top() = aPara.Top();
+ rRect.Bottom() = aPara.Bottom();
+ break;
+
+ case RelOrientation::PRINT_AREA:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aParaPrtArea.Bottom();
+ break;
+
+ case RelOrientation::CHAR:
+ if (nVAlign != VertOrientation::NONE &&
+ nVAlign != VertOrientation::CHAR_BOTTOM)
+ rRect.Top() = aAutoCharFrame.Top();
+ else
+ rRect.Top() = aAutoCharFrame.Bottom();
+ rRect.Bottom() = aAutoCharFrame.Bottom();
+ break;
+ // OD 12.11.2003 #i22341#
+ case RelOrientation::TEXT_LINE:
+ rRect.Top() = aAutoCharFrame.Top();
+ rRect.Bottom() = aAutoCharFrame.Top();
+ break;
+ }
+ }
+ break;
+
+ case TextContentAnchorType_AS_CHARACTER:
+ rRect.Left() = aParaPrtArea.Left();
+ rRect.Right() = aParaPrtArea.Right();
+
+ switch (nVAlign)
+ {
+ case VertOrientation::NONE:
+ case VertOrientation::TOP:
+ case VertOrientation::CENTER:
+ case VertOrientation::BOTTOM:
+ {
+ FontMetric aMetric(GetFontMetric());
+
+ rRect.Top() = aParaPrtArea.Bottom() - aMetric.GetDescent();
+ rRect.Bottom() = rRect.Top();
+ }
+ break;
+
+ default:
+
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::LINE_BOTTOM:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aDrawObj.Bottom();
+ break;
+
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::CHAR_BOTTOM:
+ rRect.Top() = aParaPrtArea.Top();
+ rRect.Bottom() = aParaPrtArea.Bottom();
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+Rectangle SvxSwFrameExample::DrawInnerFrame_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor)
+{
+ DrawRect_Impl(rRect, rFillColor, rBorderColor);
+
+ // Bereich, zu dem relativ positioniert wird, bestimmen
+ Rectangle aRect(rRect); // aPagePrtArea = Default
+ CalcBoundRect_Impl(aRect);
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME && &rRect == &aPagePrtArea)
+ {
+ // Testabsatz zeichnen
+ Rectangle aTxt(aTextLine);
+ sal_Int32 nStep = aTxt.GetHeight() + 2;
+ sal_uInt16 nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
+
+ for (sal_uInt16 i = 0; i < nLines; i++)
+ {
+ if (i == nLines - 1)
+ aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
+ DrawRect_Impl(aTxt, m_aTxtCol, m_aTransColor);
+ aTxt.Move(0, nStep);
+ }
+ }
+
+ return aRect;
+}
+
+void SvxSwFrameExample::Paint(const Rectangle&)
+{
+ InitAllRects_Impl();
+
+ // Schatten zeichnen
+// Rectangle aShadow(aPage);
+// aShadow += Point(3, 3);
+// DrawRect_Impl(aShadow, Color(COL_GRAY), aTransColor);
+
+ // Seite zeichnen
+ DrawRect_Impl( aPage, m_aBgCol, m_aBorderCol );
+
+ // PrintArea zeichnen
+ Rectangle aRect = DrawInnerFrame_Impl( aPagePrtArea, m_aTransColor, m_aPrintAreaCol );
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ aRect = DrawInnerFrame_Impl( aFrameAtFrame, m_aBgCol, m_aBorderCol );
+
+ long lXPos = 0;
+ long lYPos = 0;
+
+ // Horizontale Ausrichtung
+ //
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ switch (nHAlign)
+ {
+ case HoriOrientation::RIGHT:
+ {
+ lXPos = aRect.Right() - aFrmSize.Width() + 1;
+ break;
+ }
+ case HoriOrientation::CENTER:
+ {
+ lXPos = aRect.Left() + (aRect.GetWidth() - aFrmSize.Width()) / 2;
+ break;
+ }
+ case HoriOrientation::NONE:
+ {
+ lXPos = aRect.Left() + aRelPos.X();
+ break;
+ }
+
+ default: // HoriOrientation::LEFT
+ lXPos = aRect.Left();
+ break;
+ }
+ }
+ else
+ lXPos = aRect.Right() + 2;
+
+ // Vertikale Ausrichtung
+ //
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ switch (nVAlign)
+ {
+ case VertOrientation::BOTTOM:
+ case VertOrientation::LINE_BOTTOM:
+ {
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::TEXT_LINE )
+ {
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ }
+ else
+ {
+ lYPos = aRect.Top();
+ }
+ break;
+ }
+ case VertOrientation::CENTER:
+ case VertOrientation::LINE_CENTER:
+ {
+ lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
+ break;
+ }
+ case VertOrientation::NONE:
+ {
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::CHAR && nVRel != RelOrientation::TEXT_LINE )
+ lYPos = aRect.Top() + aRelPos.Y();
+ else
+ lYPos = aRect.Top() - aRelPos.Y();
+ break;
+ }
+ default:
+ // OD 12.11.2003 #i22341#
+ if ( nVRel != RelOrientation::TEXT_LINE )
+ {
+ lYPos = aRect.Top();
+ }
+ else
+ {
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ }
+ break;
+ }
+ }
+ else
+ {
+ switch(nVAlign)
+ {
+ case VertOrientation::CENTER:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::LINE_CENTER:
+ lYPos = aRect.Top() + (aRect.GetHeight() - aFrmSize.Height()) / 2;
+ break;
+
+ case VertOrientation::TOP:
+ case VertOrientation::CHAR_BOTTOM:
+ case VertOrientation::LINE_BOTTOM:
+ lYPos = aRect.Bottom() - aFrmSize.Height() + 1;
+ break;
+
+/* case VertOrientation::NONE:
+ case VertOrientation::BOTTOM:
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::LINE_TOP:*/
+ default:
+ lYPos = aRect.Top() - aRelPos.Y();
+ break;
+ }
+ }
+
+ Rectangle aFrmRect(Point(lXPos, lYPos), aFrmSize);
+
+ Rectangle *pOuterFrame = &aPage;
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ pOuterFrame = &aFrameAtFrame;
+
+ if (aFrmRect.Left() < pOuterFrame->Left())
+ aFrmRect.Move(pOuterFrame->Left() - aFrmRect.Left(), 0);
+ if (aFrmRect.Right() > pOuterFrame->Right())
+ aFrmRect.Move(pOuterFrame->Right() - aFrmRect.Right(), 0);
+
+ if (aFrmRect.Top() < pOuterFrame->Top())
+ aFrmRect.Move(0, pOuterFrame->Top() - aFrmRect.Top());
+ if (aFrmRect.Bottom() > pOuterFrame->Bottom())
+ aFrmRect.Move(0, pOuterFrame->Bottom() - aFrmRect.Bottom());
+
+ // Testabsatz zeichnen
+ const long nTxtLineHeight = aTextLine.GetHeight();
+ Rectangle aTxt(aTextLine);
+ sal_Int32 nStep;
+ sal_uInt16 nLines;
+
+ if (nAnchor == TextContentAnchorType_AT_FRAME)
+ {
+ aTxt.Left() = aFrameAtFrame.Left() + FLYINFLY_BORDER;
+ aTxt.Right() = aFrameAtFrame.Right() - FLYINFLY_BORDER;
+ aTxt.Top() = aFrameAtFrame.Top() + FLYINFLY_BORDER;
+ aTxt.Bottom() = aTxt.Top() + aTextLine.GetHeight() - 1;
+
+ nStep = aTxt.GetHeight() + 2;
+ nLines = (sal_uInt16)(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3)
+ / (aTxt.GetHeight() + 2));
+ }
+ else
+ {
+ nStep = aTxt.GetHeight() + 2;
+ nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2));
+ }
+
+ if (nAnchor != TextContentAnchorType_AS_CHARACTER)
+ {
+ // Text simulieren
+ //
+ const long nOldR = aTxt.Right();
+ const long nOldL = aTxt.Left();
+
+ // OD 12.11.2003 #i22341#
+ const bool bIgnoreWrap = nAnchor == TextContentAnchorType_AT_CHARACTER &&
+ ( nHRel == RelOrientation::CHAR || nVRel == RelOrientation::CHAR ||
+ nVRel == RelOrientation::TEXT_LINE );
+
+ for (sal_uInt16 i = 0; i < nLines; ++i)
+ {
+ if (i == (nLines - 1))
+ aTxt.SetSize(Size(aTxt.GetWidth() / 2, aTxt.GetHeight()));
+
+ if (aTxt.IsOver(aFrmRect) && nAnchor != TextContentAnchorType_AS_CHARACTER && !bIgnoreWrap)
+ {
+ switch(nWrap)
+ {
+ case WrapTextMode_NONE:
+ aTxt.Top() = aFrmRect.Bottom() + nTxtLineHeight;
+ aTxt.Bottom() = aTxt.Top() + nTxtLineHeight - 1;
+ break;
+
+ case WrapTextMode_LEFT:
+ aTxt.Right() = aFrmRect.Left();
+ break;
+
+ case WrapTextMode_RIGHT:
+ aTxt.Left() = aFrmRect.Right();
+ break;
+ }
+ }
+ if (pOuterFrame->IsInside(aTxt))
+ DrawRect_Impl( aTxt, m_aTxtCol, m_aTransColor );
+
+ aTxt.Move(0, nStep);
+ aTxt.Right() = nOldR;
+ aTxt.Left() = nOldL;
+ }
+ aTxt.Move(0, -nStep);
+
+ if (nAnchor != TextContentAnchorType_AT_FRAME && aTxt.Bottom() > aParaPrtArea.Bottom())
+ {
+ // Text wurde durch Rahmen verdraengt, daher Para-Hoehe anpassen
+ sal_uIntPtr nDiff = aTxt.Bottom() - aParaPrtArea.Bottom();
+ aParaPrtArea.Bottom() += nDiff;
+ aPara.Bottom() += nDiff;
+
+ CalcBoundRect_Impl(aRect);
+
+ aParaPrtArea.Bottom() -= nDiff;
+ aPara.Bottom() -= nDiff;
+ }
+ if (nAnchor == TextContentAnchorType_AT_CHARACTER && bIgnoreWrap)
+ DrawText(aAutoCharFrame, 'A');
+ }
+ else
+ {
+ DrawText(aParaPrtArea, C2S(DEMOTEXT));
+ DrawRect_Impl(aDrawObj, m_aBlankCol, m_aBlankFrameCol );
+ }
+
+ // Rechteck zeichnen, zu dem der Rahmen ausgerichtet wird:
+ DrawRect_Impl(aRect, m_aTransColor, m_aAlignColor);
+
+ // Frame anzeigen
+ sal_Bool bDontFill = (nAnchor == TextContentAnchorType_AT_CHARACTER && aFrmRect.IsOver(aAutoCharFrame)) ? sal_True : bTrans;
+ DrawRect_Impl( aFrmRect, bDontFill? m_aTransColor : m_aBgCol, m_aFrameColor );
+}
+
+void SvxSwFrameExample::SetRelPos(const Point& rP)
+{
+ aRelPos = rP;
+
+ if (aRelPos.X() > 0)
+ aRelPos.X() = 5;
+ if (aRelPos.X() < 0)
+ aRelPos.X() = -5;
+
+ if (aRelPos.Y() > 0)
+ aRelPos.Y() = 5;
+ if (aRelPos.Y() < 0)
+ aRelPos.Y() = -5;
+}
+
+void SvxSwFrameExample::DrawRect_Impl(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
+{
+ SetFillColor(rFillColor);
+ SetLineColor(rLineColor);
+ Window::DrawRect(rRect);
+}
+
+
+
diff --git a/svx/source/dialog/swframeposstrings.cxx b/svx/source/dialog/swframeposstrings.cxx
new file mode 100644
index 000000000000..5da8843489be
--- /dev/null
+++ b/svx/source/dialog/swframeposstrings.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include <svx/swframeposstrings.hxx>
+#include <tools/rc.hxx>
+#include <tools/debug.hxx>
+#include <svx/dialmgr.hxx>
+#include <svx/dialogs.hrc>
+
+class SvxSwFramePosString_Impl : public Resource
+{
+ friend class SvxSwFramePosString;
+ String aStrings[SvxSwFramePosString::STR_MAX];
+public:
+ SvxSwFramePosString_Impl();
+};
+SvxSwFramePosString_Impl::SvxSwFramePosString_Impl() :
+ Resource(SVX_RES(RID_SVXSW_FRAMEPOSITIONS))
+{
+ for(sal_uInt16 i = 0; i < SvxSwFramePosString::STR_MAX; i++)
+ {
+ //string ids have to start at 1
+ aStrings[i] = String(SVX_RES(i + 1));
+ }
+ FreeResource();
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwFramePosString::SvxSwFramePosString() :
+ pImpl(new SvxSwFramePosString_Impl)
+{
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SvxSwFramePosString::~SvxSwFramePosString()
+{
+ delete pImpl;
+}
+/*-- 04.03.2004 13:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const String& SvxSwFramePosString::GetString(StringId eId)
+{
+ DBG_ASSERT(eId >= 0 && eId < STR_MAX, "invalid StringId");
+ if(!(eId >= 0 && eId < STR_MAX))
+ eId = LEFT;
+ return pImpl->aStrings[eId];
+}
diff --git a/svx/source/dialog/swframeposstrings.src b/svx/source/dialog/swframeposstrings.src
new file mode 100644
index 000000000000..c6a164630c5e
--- /dev/null
+++ b/svx/source/dialog/swframeposstrings.src
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/dialogs.hrc>
+
+//the following defines have to match the (enum values + 1) in svx/swframeposstrings.hxx!
+#define STR_LEFT 1
+#define STR_RIGHT 2
+#define STR_FROMLEFT 3
+#define STR_MIR_LEFT 4
+#define STR_MIR_RIGHT 5
+#define STR_MIR_FROMLEFT 6
+#define STR_FRAME 7
+#define STR_PRTAREA 8
+#define STR_REL_PG_LEFT 9
+#define STR_REL_PG_RIGHT 10
+#define STR_REL_FRM_LEFT 11
+#define STR_REL_FRM_RIGHT 12
+#define STR_MIR_REL_PG_LEFT 13
+#define STR_MIR_REL_PG_RIGHT 14
+#define STR_MIR_REL_FRM_LEFT 15
+#define STR_MIR_REL_FRM_RIGHT 16
+#define STR_REL_PG_FRAME 17
+#define STR_REL_PG_PRTAREA 18
+#define STR_REL_BASE 19
+#define STR_REL_CHAR 20
+#define STR_REL_ROW 21
+#define STR_REL_BORDER 22
+#define STR_REL_PRTAREA 23
+#define STR_FLY_REL_PG_LEFT 24
+#define STR_FLY_REL_PG_RIGHT 25
+#define STR_FLY_REL_PG_FRAME 26
+#define STR_FLY_REL_PG_PRTAREA 27
+#define STR_FLY_MIR_REL_PG_LEFT 28
+#define STR_FLY_MIR_REL_PG_RIGHT 29
+#define STR_TOP 30
+#define STR_BOTTOM 31
+#define STR_CENTER_HORI 32
+#define STR_CENTER_VERT 33
+#define STR_FROMTOP 34
+#define STR_FROMBOTTOM 35
+#define STR_BELOW 36
+#define STR_FROMRIGHT 37
+#define STR_REL_PG_TOP 38
+#define STR_REL_PG_BOTTOM 39
+#define STR_REL_FRM_TOP 40
+#define STR_REL_FRM_BOTTOM 41
+#define STR_REL_LINE 42
+
+Resource RID_SVXSW_FRAMEPOSITIONS
+{
+ String STR_LEFT
+ {
+ Text [ en-US ] = "Left" ;
+ };
+ String STR_MIR_LEFT
+ {
+ Text [ en-US ] = "Inside" ;
+ };
+ String STR_RIGHT
+ {
+ Text [ en-US ] = "Right" ;
+ };
+ String STR_MIR_RIGHT
+ {
+ Text [ en-US ] = "Outside" ;
+ };
+ String STR_CENTER_VERT
+ {
+ Text [ en-US ] = "Center" ;
+ };
+ String STR_FROMLEFT
+ {
+ Text [ en-US ] = "From left" ;
+ };
+ String STR_MIR_FROMLEFT
+ {
+ Text [ en-US ] = "From inside" ;
+ };
+ String STR_FRAME
+ {
+ Text [ en-US ] = "Paragraph area" ;
+ };
+ String STR_PRTAREA
+ {
+ Text [ en-US ] = "Paragraph text area" ;
+ };
+ String STR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Left page border" ;
+ };
+ String STR_MIR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Inner page border" ;
+ };
+ String STR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Right page border" ;
+ };
+ String STR_MIR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Outer page border" ;
+ };
+ String STR_REL_FRM_LEFT
+ {
+ Text [ en-US ] = "Left paragraph border" ;
+ };
+ String STR_MIR_REL_FRM_LEFT
+ {
+ Text [ en-US ] = "Inner paragraph border" ;
+ };
+ String STR_REL_FRM_RIGHT
+ {
+ Text [ en-US ] = "Right paragraph border" ;
+ };
+ String STR_MIR_REL_FRM_RIGHT
+ {
+ Text [ en-US ] = "Outer paragraph border" ;
+ };
+ String STR_REL_PG_FRAME
+ {
+ Text [ en-US ] = "Entire page" ;
+ };
+ String STR_REL_PG_PRTAREA
+ {
+ Text [ en-US ] = "Page text area" ;
+ };
+ String STR_TOP
+ {
+ Text [ en-US ] = "Top" ;
+ };
+ String STR_BOTTOM
+ {
+ Text [ en-US ] = "Bottom" ;
+ };
+ String STR_CENTER_HORI
+ {
+ Text [ en-US ] = "Center" ;
+ };
+ String STR_FROMTOP
+ {
+ Text [ en-US ] = "From top" ;
+ };
+ String STR_FROMBOTTOM
+ {
+ Text [ en-US ] = "From bottom" ;
+ };
+ String STR_BELOW
+ {
+ Text [ en-US ] = "Below" ;
+ };
+ String STR_FROMRIGHT
+ {
+ Text [ en-US ] = "From right" ;
+ };
+ String STR_REL_PG_TOP
+ {
+ Text [ en-US ] = "Top page border" ;
+ };
+ String STR_REL_PG_BOTTOM
+ {
+ Text [ en-US ] = "Bottom page border" ;
+ };
+ String STR_REL_FRM_TOP
+ {
+ Text [ en-US ] = "Top paragraph border" ;
+ };
+ String STR_REL_FRM_BOTTOM
+ {
+ Text [ en-US ] = "Bottom paragraph border" ;
+ };
+ String STR_REL_BORDER
+ {
+ Text [ en-US ] = "Margin" ;
+ };
+ String STR_REL_PRTAREA
+ {
+ Text [ en-US ] = "Paragraph text area" ;
+ };
+ String STR_FLY_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Left frame border" ;
+ };
+ String STR_FLY_MIR_REL_PG_LEFT
+ {
+ Text [ en-US ] = "Inner frame border" ;
+ };
+ String STR_FLY_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Right frame border" ;
+ };
+ String STR_FLY_MIR_REL_PG_RIGHT
+ {
+ Text [ en-US ] = "Outer frame border" ;
+ };
+ String STR_FLY_REL_PG_FRAME
+ {
+ Text [ en-US ] = "Entire frame" ;
+ };
+ String STR_FLY_REL_PG_PRTAREA
+ {
+ Text [ en-US ] = "Frame text area" ;
+ };
+ String STR_REL_BASE
+ {
+ Text [ en-US ] = "Base line" ;
+ };
+ String STR_REL_CHAR
+ {
+ Text [ en-US ] = "Character" ;
+ };
+ String STR_REL_ROW
+ {
+ Text [ en-US ] = "Row" ;
+ };
+ // OD 05.01.2004 #i22341#
+ String STR_REL_LINE
+ {
+ Text [ en-US ] = "Line of text" ;
+ };
+};
+
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
new file mode 100644
index 000000000000..132ca585a87f
--- /dev/null
+++ b/svx/source/dialog/txencbox.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include "svx/txencbox.hxx"
+#include "svx/txenctab.hxx"
+#include <svx/dialogs.hrc>
+#include "svx/dbcharsethelper.hxx"
+#include <vcl/svapp.hxx>
+#include <rtl/tencinfo.h>
+#include <rtl/locale.h>
+#include <osl/nlsupport.h>
+
+//========================================================================
+// class SvxTextEncodingBox
+//========================================================================
+
+SvxTextEncodingBox::SvxTextEncodingBox( Window* pParent, const ResId& rResId )
+ :
+ ListBox( pParent, rResId )
+{
+ m_pEncTable = new SvxTextEncodingTable;
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingBox::~SvxTextEncodingBox()
+{
+ delete m_pEncTable;
+}
+
+//------------------------------------------------------------------------
+
+sal_uInt16 SvxTextEncodingBox::EncodingToPos_Impl( rtl_TextEncoding nEnc ) const
+{
+ sal_uInt16 nCount = GetEntryCount();
+ for ( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ if ( nEnc == rtl_TextEncoding( (sal_uIntPtr)GetEntryData(i) ) )
+ return i;
+ }
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillFromTextEncodingTable(
+ sal_Bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags,
+ sal_uInt32 nButIncludeInfoFlags )
+{
+ rtl_TextEncodingInfo aInfo;
+ aInfo.StructSize = sizeof(rtl_TextEncodingInfo);
+ sal_uInt32 nCount = m_pEncTable->Count();
+ for ( sal_uInt32 j=0; j<nCount; j++ )
+ {
+ sal_Bool bInsert = sal_True;
+ rtl_TextEncoding nEnc = rtl_TextEncoding( m_pEncTable->GetValue( j ) );
+ if ( nExcludeInfoFlags )
+ {
+ if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
+ bInsert = sal_False;
+ else
+ {
+ if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
+ {
+ if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
+ ((nEnc == RTL_TEXTENCODING_UCS2) ||
+ nEnc == RTL_TEXTENCODING_UCS4) )
+ bInsert = sal_False; // InfoFlags don't work for Unicode :-(
+ }
+ else if ( (aInfo.Flags & nButIncludeInfoFlags) == 0 )
+ bInsert = sal_False;
+ }
+ }
+ if ( bInsert )
+ {
+ if ( bExcludeImportSubsets )
+ {
+ switch ( nEnc )
+ {
+ // subsets of RTL_TEXTENCODING_GB_18030
+ case RTL_TEXTENCODING_GB_2312 :
+ case RTL_TEXTENCODING_GBK :
+ case RTL_TEXTENCODING_MS_936 :
+ bInsert = sal_False;
+ break;
+ }
+ }
+ if ( bInsert )
+ InsertTextEncoding( nEnc, m_pEncTable->GetString( j ) );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillFromDbTextEncodingMap(
+ sal_Bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags,
+ sal_uInt32 nButIncludeInfoFlags )
+{
+ rtl_TextEncodingInfo aInfo;
+ aInfo.StructSize = sizeof(rtl_TextEncodingInfo);
+ svxform::ODataAccessCharsetHelper aCSH;
+ ::std::vector< rtl_TextEncoding > aEncs;
+ sal_Int32 nCount = aCSH.getSupportedTextEncodings( aEncs );
+ for ( sal_uInt16 j=0; j<nCount; j++ )
+ {
+ sal_Bool bInsert = sal_True;
+ rtl_TextEncoding nEnc = rtl_TextEncoding( aEncs[j] );
+ if ( nExcludeInfoFlags )
+ {
+ if ( !rtl_getTextEncodingInfo( nEnc, &aInfo ) )
+ bInsert = sal_False;
+ else
+ {
+ if ( (aInfo.Flags & nExcludeInfoFlags) == 0 )
+ {
+ if ( (nExcludeInfoFlags & RTL_TEXTENCODING_INFO_UNICODE) &&
+ ((nEnc == RTL_TEXTENCODING_UCS2) ||
+ nEnc == RTL_TEXTENCODING_UCS4) )
+ bInsert = sal_False; // InfoFlags don't work for Unicode :-(
+ }
+ else if ( (aInfo.Flags & nButIncludeInfoFlags) == 0 )
+ bInsert = sal_False;
+ }
+ }
+ if ( bInsert )
+ {
+ if ( bExcludeImportSubsets )
+ {
+ switch ( nEnc )
+ {
+ // subsets of RTL_TEXTENCODING_GB_18030
+ case RTL_TEXTENCODING_GB_2312 :
+ case RTL_TEXTENCODING_GBK :
+ case RTL_TEXTENCODING_MS_936 :
+ bInsert = sal_False;
+ break;
+ }
+ }
+ // CharsetMap offers a RTL_TEXTENCODING_DONTKNOW for internal use,
+ // makes no sense here and would result in an empty string as list
+ // entry.
+ if ( bInsert && nEnc != RTL_TEXTENCODING_DONTKNOW )
+ InsertTextEncoding( nEnc );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::FillWithMimeAndSelectBest()
+{
+ FillFromTextEncodingTable( sal_False, 0xffffffff, RTL_TEXTENCODING_INFO_MIME );
+ rtl_TextEncoding nEnc = SvtSysLocale::GetBestMimeEncoding();
+ SelectTextEncoding( nEnc );
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc,
+ const String& rEntry, sal_uInt16 nPos )
+{
+ sal_uInt16 nAt = InsertEntry( rEntry, nPos );
+ SetEntryData( nAt, (void*)(sal_uIntPtr)nEnc );
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::InsertTextEncoding( const rtl_TextEncoding nEnc, sal_uInt16 nPos )
+{
+ const String& rEntry = m_pEncTable->GetTextString( nEnc );
+ if ( rEntry.Len() )
+ InsertTextEncoding( nEnc, rEntry, nPos );
+ else
+ {
+#ifdef DBG_UTIL
+ ByteString aMsg( "SvxTextEncodingBox::InsertTextEncoding: no resource string for text encoding: " );
+ aMsg += ByteString::CreateFromInt32( nEnc );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+#endif
+ }
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::RemoveTextEncoding( const rtl_TextEncoding nEnc )
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ RemoveEntry( nAt );
+}
+
+//------------------------------------------------------------------------
+
+rtl_TextEncoding SvxTextEncodingBox::GetSelectTextEncoding() const
+{
+ sal_uInt16 nPos = GetSelectEntryPos();
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return rtl_TextEncoding( (sal_uIntPtr)GetEntryData(nPos) );
+ else
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
+//------------------------------------------------------------------------
+
+void SvxTextEncodingBox::SelectTextEncoding( const rtl_TextEncoding nEnc, sal_Bool bSelect )
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nAt, bSelect );
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxTextEncodingBox::IsTextEncodingSelected( const rtl_TextEncoding nEnc ) const
+{
+ sal_uInt16 nAt = EncodingToPos_Impl( nEnc );
+
+ if ( nAt != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nAt );
+ else
+ return sal_False;
+}
+
diff --git a/svx/source/dialog/txenctab.cxx b/svx/source/dialog/txenctab.cxx
new file mode 100644
index 000000000000..74b60a08d2bd
--- /dev/null
+++ b/svx/source/dialog/txenctab.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/dialogs.hrc> // -> RID_SVXSTR_TEXTENCODING_TABLE
+#include <svx/dialmgr.hxx>
+#include "svx/txenctab.hxx"
+#include <tools/shl.hxx>
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingTable::SvxTextEncodingTable()
+ :
+ ResStringArray( SVX_RES( RID_SVXSTR_TEXTENCODING_TABLE ) )
+{
+}
+
+//------------------------------------------------------------------------
+
+SvxTextEncodingTable::~SvxTextEncodingTable()
+{
+}
+
+//------------------------------------------------------------------------
+
+const String& SvxTextEncodingTable::GetTextString( const rtl_TextEncoding nEnc ) const
+{
+ sal_uInt32 nPos = FindIndex( (long)nEnc );
+
+ if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
+ return ResStringArray::GetString( nPos );
+
+ static String aEmptyString;
+ return aEmptyString;
+}
+
+//------------------------------------------------------------------------
+
+rtl_TextEncoding SvxTextEncodingTable::GetTextEncoding( const String& rStr ) const
+{
+ sal_uInt32 nCount = Count();
+
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ {
+ if ( rStr == ResStringArray::GetString( i ) )
+ return rtl_TextEncoding( GetValue( i ) );
+ }
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
diff --git a/svx/source/dialog/txenctab.src b/svx/source/dialog/txenctab.src
new file mode 100644
index 000000000000..b90b5fb9a94c
--- /dev/null
+++ b/svx/source/dialog/txenctab.src
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+
+#include <svx/dialogs.hrc>
+
+#define _SOLAR_RSC_INVOKED
+#include <rtl/textenc.h>
+#define PairedList ItemList
+// Encodings for which no conversion exist yet are commented out.
+
+ // RID_SVXSTR_TEXTENCODING_TABLE ----------------------------------------------------
+StringArray RID_SVXSTR_TEXTENCODING_TABLE
+{
+ PairedList [ en-US ] =
+ {
+ < "Western Europe (Windows-1252/WinLatin 1)" ; RTL_TEXTENCODING_MS_1252 ; > ;
+ < "Western Europe (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_ROMAN ; > ;
+ < "Western Europe (DOS/OS2-850/International)" ; RTL_TEXTENCODING_IBM_850 ; > ;
+ < "Western Europe (DOS/OS2-437/US)" ; RTL_TEXTENCODING_IBM_437 ; > ;
+ < "Western Europe (DOS/OS2-860/Portuguese)" ; RTL_TEXTENCODING_IBM_860 ; > ;
+ < "Western Europe (DOS/OS2-861/Icelandic)" ; RTL_TEXTENCODING_IBM_861 ; > ;
+ < "Western Europe (DOS/OS2-863/French (Can.))" ; RTL_TEXTENCODING_IBM_863 ; > ;
+ < "Western Europe (DOS/OS2-865/Nordic)" ; RTL_TEXTENCODING_IBM_865 ; > ;
+ < "Western Europe (ASCII/US)" ; RTL_TEXTENCODING_ASCII_US ; > ;
+ < "Western Europe (ISO-8859-1)" ; RTL_TEXTENCODING_ISO_8859_1 ; > ;
+ < "Eastern Europe (ISO-8859-2)" ; RTL_TEXTENCODING_ISO_8859_2 ; > ;
+ < "Latin 3 (ISO-8859-3)" ; RTL_TEXTENCODING_ISO_8859_3 ; > ;
+ < "Baltic (ISO-8859-4)" ; RTL_TEXTENCODING_ISO_8859_4 ; > ;
+ < "Cyrillic (ISO-8859-5)" ; RTL_TEXTENCODING_ISO_8859_5 ; > ;
+ < "Arabic (ISO-8859-6)" ; RTL_TEXTENCODING_ISO_8859_6 ; > ;
+ < "Greek (ISO-8859-7)" ; RTL_TEXTENCODING_ISO_8859_7 ; > ;
+ < "Hebrew (ISO-8859-8)" ; RTL_TEXTENCODING_ISO_8859_8 ; > ;
+ < "Turkish (ISO-8859-9)" ; RTL_TEXTENCODING_ISO_8859_9 ; > ;
+ < "Western Europe (ISO-8859-14)" ; RTL_TEXTENCODING_ISO_8859_14 ; > ;
+ < "Western Europe (ISO-8859-15/EURO)" ; RTL_TEXTENCODING_ISO_8859_15 ; > ;
+ < "Greek (DOS/OS2-737)" ; RTL_TEXTENCODING_IBM_737 ; > ;
+ < "Baltic (DOS/OS2-775)" ; RTL_TEXTENCODING_IBM_775 ; > ;
+ < "Eastern Europe (DOS/OS2-852)" ; RTL_TEXTENCODING_IBM_852 ; > ;
+ < "Cyrillic (DOS/OS2-855)" ; RTL_TEXTENCODING_IBM_855 ; > ;
+ < "Turkish (DOS/OS2-857)" ; RTL_TEXTENCODING_IBM_857 ; > ;
+ < "Hebrew (DOS/OS2-862)" ; RTL_TEXTENCODING_IBM_862 ; > ;
+ < "Arabic (DOS/OS2-864)" ; RTL_TEXTENCODING_IBM_864 ; > ;
+ < "Cyrillic (DOS/OS2-866/Russian)" ; RTL_TEXTENCODING_IBM_866 ; > ;
+ < "Greek (DOS/OS2-869/Modern)" ; RTL_TEXTENCODING_IBM_869 ; > ;
+ < "Eastern Europe (Windows-1250/WinLatin 2)" ; RTL_TEXTENCODING_MS_1250 ; > ;
+ < "Cyrillic (Windows-1251)" ; RTL_TEXTENCODING_MS_1251 ; > ;
+ < "Greek (Windows-1253)" ; RTL_TEXTENCODING_MS_1253 ; > ;
+ < "Turkish (Windows-1254)" ; RTL_TEXTENCODING_MS_1254 ; > ;
+ < "Hebrew (Windows-1255)" ; RTL_TEXTENCODING_MS_1255 ; > ;
+ < "Arabic (Windows-1256)" ; RTL_TEXTENCODING_MS_1256 ; > ;
+ < "Baltic (Windows-1257)" ; RTL_TEXTENCODING_MS_1257 ; > ;
+ < "Eastern Europe (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CENTEURO ; > ;
+ < "Eastern Europe (Apple Macintosh/Croatian)" ; RTL_TEXTENCODING_APPLE_CROATIAN ; > ;
+ < "Cyrillic (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CYRILLIC ; > ;
+ < "Greek (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_GREEK ; > ;
+ < "Western Europe (Apple Macintosh/Icelandic)" ; RTL_TEXTENCODING_APPLE_ICELAND ; > ;
+ < "Eastern Europe (Apple Macintosh/Rumanian)" ; RTL_TEXTENCODING_APPLE_ROMANIAN ; > ;
+ < "Turkish (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_TURKISH ; > ;
+ < "Cyrillic (Apple Macintosh/Ukrainian)" ; RTL_TEXTENCODING_APPLE_UKRAINIAN ; > ;
+ < "Chinese simplified (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CHINSIMP ; > ;
+ < "Chinese traditional (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_CHINTRAD ; > ;
+ < "Japanese (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_JAPANESE ; > ;
+ < "Korean (Apple Macintosh)" ; RTL_TEXTENCODING_APPLE_KOREAN ; > ;
+ < "Japanese (Windows-932)" ; RTL_TEXTENCODING_MS_932 ; > ;
+ < "Chinese simplified (Windows-936)" ; RTL_TEXTENCODING_MS_936 ; > ;
+ < "Korean (Windows-949)" ; RTL_TEXTENCODING_MS_949 ; > ;
+ < "Chinese traditional (Windows-950)" ; RTL_TEXTENCODING_MS_950 ; > ;
+ < "Japanese (Shift-JIS)" ; RTL_TEXTENCODING_SHIFT_JIS ; > ;
+ < "Chinese simplified (GB-2312)" ; RTL_TEXTENCODING_GB_2312 ; > ;
+ < "Chinese simplified (GB-18030)" ; RTL_TEXTENCODING_GB_18030 ; > ;
+ < "Chinese traditional (GBT-12345)" ; RTL_TEXTENCODING_GBT_12345 ; > ;
+ < "Chinese simplified (GBK/GB-2312-80)" ; RTL_TEXTENCODING_GBK ; > ;
+ < "Chinese traditional (Big5)" ; RTL_TEXTENCODING_BIG5 ; > ;
+ < "Chinese traditional (BIG5-HKSCS)" ; RTL_TEXTENCODING_BIG5_HKSCS ; > ;
+ < "Japanese (EUC-JP)" ; RTL_TEXTENCODING_EUC_JP ; > ;
+ < "Chinese simplified (EUC-CN)" ; RTL_TEXTENCODING_EUC_CN ; > ;
+ < "Chinese traditional (EUC-TW)" ; RTL_TEXTENCODING_EUC_TW ; > ;
+ < "Japanese (ISO-2022-JP)" ; RTL_TEXTENCODING_ISO_2022_JP ; > ;
+ < "Chinese simplified (ISO-2022-CN)" ; RTL_TEXTENCODING_ISO_2022_CN ; > ;
+ < "Cyrillic (KOI8-R)" ; RTL_TEXTENCODING_KOI8_R ; > ;
+ < "Unicode (UTF-7)" ; RTL_TEXTENCODING_UTF7 ; > ;
+ < "Unicode (UTF-8)" ; RTL_TEXTENCODING_UTF8 ; > ;
+ < "Eastern Europe (ISO-8859-10)" ; RTL_TEXTENCODING_ISO_8859_10 ; > ;
+ < "Eastern Europe (ISO-8859-13)" ; RTL_TEXTENCODING_ISO_8859_13 ; > ;
+ < "Korean (EUC-KR)" ; RTL_TEXTENCODING_EUC_KR ; > ;
+ < "Korean (ISO-2022-KR)" ; RTL_TEXTENCODING_ISO_2022_KR ; > ;
+ < "Korean (Windows-Johab-1361)" ; RTL_TEXTENCODING_MS_1361 ; > ;
+ < "Unicode" ; RTL_TEXTENCODING_UCS2 ; > ;
+ < "Thai (ISO-8859-11/TIS-620)" ; RTL_TEXTENCODING_TIS_620 ; > ;
+ < "Thai (Windows-874)" ; RTL_TEXTENCODING_MS_874 ; > ;
+ < "Cyrillic (KOI8-U)" ; RTL_TEXTENCODING_KOI8_U ; > ;
+ < "Cyrillic (PT154)" ; RTL_TEXTENCODING_PT154 ; > ;
+ };
+};
+ // ********************************************************************** EOF
+
diff --git a/svx/source/dialog/ucsubset.src b/svx/source/dialog/ucsubset.src
new file mode 100755
index 000000000000..2a47777469ea
--- /dev/null
+++ b/svx/source/dialog/ucsubset.src
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // include ---------------------------------------------------------------
+#include <svx/ucsubset.hrc>
+
+/*
+ * strings for unicode range descriptions (used e.g. by charmap)
+ * (see the Unicode Standard & TrueType::OS2.ulUnicodeRange description)
+ */
+
+Resource RID_SUBSETMAP
+{
+String RID_SUBSETSTR_BASIC_LATIN
+{
+ Text [ en-US ] = "Basic Latin";
+ };
+String RID_SUBSETSTR_LATIN_1
+{
+ Text [ en-US ] = "Latin-1";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_A
+{
+ Text [ en-US ] = "Latin Extended-A";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_B
+{
+ Text [ en-US ] = "Latin Extended-B";
+ };
+String RID_SUBSETSTR_IPA_EXTENSIONS
+{
+ Text [ en-US ] = "IPA Extensions";
+ };
+String RID_SUBSETSTR_SPACING_MODIFIERS
+{
+ Text [ en-US ] = "Spacing Modifier Letters";
+ };
+String RID_SUBSETSTR_COMB_DIACRITICAL
+{
+ Text [ en-US ] = "Combining Diacritical Marks";
+ };
+String RID_SUBSETSTR_BASIC_GREEK
+{
+ Text [ en-US ] = "Basic Greek";
+ };
+String RID_SUBSETSTR_GREEK_SYMS_COPTIC
+{
+ Text [ en-US ] = "Greek Symbols And Coptic";
+ };
+String RID_SUBSETSTR_CYRILLIC
+{
+ Text [ en-US ] = "Cyrillic";
+ };
+String RID_SUBSETSTR_CYRILLIC_SUPPL
+{
+ Text [ en-US ] = "Cyrillic Supplementary";
+ };
+String RID_SUBSETSTR_ARMENIAN
+{
+ Text [ en-US ] = "Armenian";
+ };
+String RID_SUBSETSTR_BASIC_HEBREW
+{
+ Text [ en-US ] = "Basic Hebrew";
+ };
+String RID_SUBSETSTR_HEBREW_EXTENDED
+{
+ Text [ en-US ] = "Hebrew Extended";
+ };
+String RID_SUBSETSTR_BASIC_ARABIC
+{
+ Text [ en-US ] = "Basic Arabic";
+ };
+String RID_SUBSETSTR_ARABIC_EXTENDED
+{
+ Text [ en-US ] = "Arabic Extended";
+
+ };
+String RID_SUBSETSTR_DEVANAGARI
+{
+ Text [ en-US ] = "Devanagari";
+ };
+String RID_SUBSETSTR_BENGALI
+{
+ Text [ en-US ] = "Bengali";
+ };
+String RID_SUBSETSTR_GURMUKHI
+{
+ Text [ en-US ] = "Gurmukhi";
+ };
+String RID_SUBSETSTR_GUJARATI
+{
+ Text [ en-US ] = "Gujarati";
+ };
+String RID_SUBSETSTR_ORIYA
+{
+ Text [ en-US ] = "Oriya";
+ };
+String RID_SUBSETSTR_TAMIL
+{
+ Text [ en-US ] = "Tamil";
+ };
+String RID_SUBSETSTR_TELUGU
+{
+ Text [ en-US ] = "Telugu";
+
+ };
+String RID_SUBSETSTR_KANNADA
+{
+ Text [ en-US ] = "Kannada";
+ };
+String RID_SUBSETSTR_MALAYALAM
+{
+ Text [ en-US ] = "Malayalam";
+ };
+String RID_SUBSETSTR_THAI
+{
+ Text [ en-US ] = "Thai";
+ };
+String RID_SUBSETSTR_LAO
+{
+ Text [ en-US ] = "Lao";
+ };
+String RID_SUBSETSTR_BASIC_GEORGIAN
+{
+ Text [ en-US ] = "Basic Georgian";
+ };
+String RID_SUBSETSTR_GEORGIAN_EXTENDED
+{
+ Text [ en-US ] = "Georgian Extended";
+ };
+String RID_SUBSETSTR_HANGUL_JAMO
+{
+ Text [ en-US ] = "Hangul Jamo";
+ };
+String RID_SUBSETSTR_LATIN_EXTENDED_ADDS
+{
+ Text [ en-US ] = "Latin Extended Additionals";
+ };
+String RID_SUBSETSTR_GREEK_EXTENDED
+{
+ Text [ en-US ] = "Greek Extended";
+ };
+String RID_SUBSETSTR_GENERAL_PUNCTUATION
+{
+ Text [ en-US ] = "General punctuation";
+ };
+String RID_SUBSETSTR_SUB_SUPER_SCRIPTS
+{
+ Text [ en-US ] = "Superscripts and Subscripts";
+ };
+String RID_SUBSETSTR_CURRENCY_SYMBOLS
+{
+ Text [ en-US ] = "Currency Symbols";
+ };
+String RID_SUBSETSTR_COMB_DIACRITIC_SYMS
+{
+ Text [ en-US ] = "Combining Diacritical Symbols";
+ };
+String RID_SUBSETSTR_LETTERLIKE_SYMBOLS
+{
+ Text [ en-US ] = "Letterlike Symbols";
+ };
+String RID_SUBSETSTR_NUMBER_FORMS
+{
+ Text [ en-US ] = "Number Forms";
+ };
+String RID_SUBSETSTR_ARROWS
+{
+ Text [ en-US ] = "Arrows";
+ };
+String RID_SUBSETSTR_MATH_OPERATORS
+{
+ Text [ en-US ] = "Mathematical Operators";
+ };
+String RID_SUBSETSTR_MISC_TECHNICAL
+{
+ Text [ en-US ] = "Miscellaneous Technical";
+
+ };
+String RID_SUBSETSTR_CONTROL_PICTURES
+{
+ Text [ en-US ] = "Control Pictures";
+ };
+String RID_SUBSETSTR_OPTICAL_CHAR_REC
+{
+ Text [ en-US ] = "Optical Character Recognition";
+ };
+String RID_SUBSETSTR_ENCLOSED_ALPHANUM
+{
+ Text [ en-US ] = "Enclosed Alphanumerics";
+ };
+String RID_SUBSETSTR_BOX_DRAWING
+{
+ Text [ en-US ] = "Box Drawing";
+ };
+String RID_SUBSETSTR_BLOCK_ELEMENTS
+{
+ Text [ en-US ] = "Block Elements";
+ };
+String RID_SUBSETSTR_GEOMETRIC_SHAPES
+{
+ Text [ en-US ] = "Geometric Shapes";
+ };
+String RID_SUBSETSTR_MISC_DINGBATS
+{
+ Text [ en-US ] = "Miscellaneous Symbols";
+
+ };
+String RID_SUBSETSTR_DINGBATS
+{
+ Text [ en-US ] = "Dingbats";
+
+ };
+String RID_SUBSETSTR_CJK_SYMS_PUNCTUATION
+{
+ Text [ en-US ] = "CJK Symbols And Punctuation";
+ };
+String RID_SUBSETSTR_HIRAGANA
+{
+ Text [ en-US ] = "Hiragana";
+ };
+String RID_SUBSETSTR_KATAKANA
+{
+ Text [ en-US ] = "Katakana";
+ };
+String RID_SUBSETSTR_BOPOMOFO
+{
+ Text [ en-US ] = "Bopomofo";
+ };
+String RID_SUBSETSTR_HANGUL_COMPAT_JAMO
+{
+ Text [ en-US ] = "Hangul Compatibility Jamo";
+ };
+String RID_SUBSETSTR_CJK_MISC
+{
+ Text [ en-US ] = "CJK Miscellaneous";
+ };
+String RID_SUBSETSTR_ENCLOSED_CJK_LETTERS
+{
+ Text [ en-US ] = "Enclosed CJK Letters And Months";
+ };
+String RID_SUBSETSTR_CJK_COMPATIBILITY
+{
+ Text [ en-US ] = "CJK Compatibility";
+
+ };
+String RID_SUBSETSTR_HANGUL
+{
+ Text [ en-US ] = "Hangul";
+ };
+String RID_SUBSETSTR_CJK_UNIFIED_IDGRAPH
+{
+ Text [ en-US ] = "CJK Unified Ideographs";
+ };
+String RID_SUBSETSTR_CJK_EXT_A_UNIFIED_IDGRAPH
+{
+ Text [ en-US ] = "CJK Unified Ideographs Extension-A";
+ };
+String RID_SUBSETSTR_PRIVATE_USE_AREA
+{
+ Text [ en-US ] = "Private Use Area";
+ };
+String RID_SUBSETSTR_CJK_COMPAT_IDGRAPHS
+{
+ Text [ en-US ] = "CJK Compatibility Ideographs";
+ };
+String RID_SUBSETSTR_ALPHA_PRESENTATION
+{
+ Text [ en-US ] = "Alphabetic Presentation Forms";
+ };
+String RID_SUBSETSTR_ARABIC_PRESENT_A
+{
+ Text [ en-US ] = "Arabic Presentation Forms-A";
+
+ };
+String RID_SUBSETSTR_COMBINING_HALF_MARKS
+{
+ Text [ en-US ] = "Combining Half Marks";
+ };
+String RID_SUBSETSTR_CJK_COMPAT_FORMS
+{
+ Text [ en-US ] = "CJK Compatibility Forms";
+ };
+String RID_SUBSETSTR_SMALL_FORM_VARIANTS
+{
+ Text [ en-US ] = "Small Form Variants";
+
+ };
+String RID_SUBSETSTR_ARABIC_PRESENT_B
+{
+ Text [ en-US ] = "Arabic Presentation Forms-B";
+ };
+String RID_SUBSETSTR_HALFW_FULLW_FORMS
+{
+ Text [ en-US ] = "Half-width and Full-width Forms";
+ };
+String RID_SUBSETSTR_SPECIALS
+{
+ Text [ en-US ] = "Specials";
+ };
+String RID_SUBSETSTR_HANGUL_GA
+{
+ Text [ en-US ] = "Hangul Ga";
+ };
+String RID_SUBSETSTR_HANGUL_NA
+{
+ Text [ en-US ] = "Hangul Na";
+ };
+String RID_SUBSETSTR_HANGUL_DA
+{
+ Text [ en-US ] = "Hangul Da";
+ };
+String RID_SUBSETSTR_HANGUL_RA
+{
+ Text [ en-US ] = "Hangul Ra";
+ };
+String RID_SUBSETSTR_HANGUL_MA
+{
+ Text [ en-US ] = "Hangul Ma";
+ };
+String RID_SUBSETSTR_HANGUL_BA
+{
+ Text [ en-US ] = "Hangul Ba";
+ };
+String RID_SUBSETSTR_HANGUL_SA
+{
+ Text [ en-US ] = "Hangul Sa";
+ };
+String RID_SUBSETSTR_HANGUL_AH
+{
+ Text [ en-US ] = "Hangul Ah";
+ };
+String RID_SUBSETSTR_HANGUL_JA
+{
+ Text [ en-US ] = "Hangul Ja";
+ };
+String RID_SUBSETSTR_HANGUL_CHA
+{
+ Text [ en-US ] = "Hangul Cha";
+ };
+String RID_SUBSETSTR_HANGUL_KA
+{
+ Text [ en-US ] = "Hangul Ka";
+ };
+String RID_SUBSETSTR_HANGUL_TA
+{
+ Text [ en-US ] = "Hangul Ta";
+ };
+String RID_SUBSETSTR_HANGUL_PA
+{
+ Text [ en-US ] = "Hangul Pa";
+ };
+String RID_SUBSETSTR_HANGUL_HA
+{
+ Text [ en-US ] = "Hangul Ha";
+ };
+String RID_SUBSETSTR_YI
+{
+ Text [ en-US ] = "Yi";
+ };
+String RID_SUBSETSTR_SINHALA
+{
+ Text [ en-US ] = "Sinhala";
+ };
+String RID_SUBSETSTR_TIBETAN
+{
+ Text [ en-US ] = "Tibetan";
+ };
+String RID_SUBSETSTR_MYANMAR
+{
+ Text [ en-US ] = "Myanmar";
+ };
+String RID_SUBSETSTR_KHMER
+{
+ Text [ en-US ] = "Khmer";
+ };
+String RID_SUBSETSTR_OGHAM
+{
+ Text [ en-US ] = "Ogham";
+ };
+String RID_SUBSETSTR_RUNIC
+{
+ Text [ en-US ] = "Runic";
+ };
+String RID_SUBSETSTR_SYRIAC
+{
+ Text [ en-US ] = "Syriac";
+ };
+String RID_SUBSETSTR_THAANA
+{
+ Text [ en-US ] = "Thaana";
+ };
+String RID_SUBSETSTR_ETHIOPIC
+{
+ Text [ en-US ] = "Ethiopic";
+ };
+String RID_SUBSETSTR_CHEROKEE
+{
+ Text [ en-US ] = "Cherokee";
+ };
+String RID_SUBSETSTR_CANADIAN_ABORIGINAL
+{
+ Text [ en-US ] = "Canadan Aboriginal Syllables";
+ };
+String RID_SUBSETSTR_MONGOLIAN
+{
+ Text [ en-US ] = "Mongolian";
+ };
+
+String RID_SUBSETSTR_MISC_MATH_SYMS_A
+{
+ Text [ en-US ] = "Miscellaneous Mathematical Symbols-A";
+ };
+
+String RID_SUBSETSTR_SUPPL_ARROWS_A
+{
+ Text [ en-US ] = "Supplemental Arrows-A";
+ };
+
+String RID_SUBSETSTR_BRAILLE_PATTERNS
+{
+ Text [ en-US ] = "Braille Patterns";
+ };
+
+String RID_SUBSETSTR_SUPPL_ARROWS_B
+{
+ Text [ en-US ] = "Supplemental Arrows-B";
+ };
+
+String RID_SUBSETSTR_MISC_MATH_SYMS_B
+{
+ Text [ en-US ] = "Miscellaneous Mathematical Symbols-B";
+ };
+
+String RID_SUBSETSTR_CJK_RADICAL_SUPPL
+{
+ Text [ en-US ] = "CJK Radical Supplement";
+ };
+
+String RID_SUBSETSTR_KANXI_RADICALS
+{
+ Text [ en-US ] = "Kanxi Radicals";
+ };
+
+String RID_SUBSETSTR_IDEO_DESC_CHARS
+{
+ Text [ en-US ] = "Ideographic Description Characters";
+ };
+
+String RID_SUBSETSTR_TAGALOG
+{
+ Text [ en-US ] = "Tagalog";
+ };
+
+String RID_SUBSETSTR_HANUNOO
+{
+ Text [ en-US ] = "Hanunoo";
+ };
+
+String RID_SUBSETSTR_TAGBANWA
+{
+ Text [ en-US ] = "Tagbanwa";
+ };
+
+String RID_SUBSETSTR_BUHID
+{
+ Text [ en-US ] = "Buhid";
+ };
+
+String RID_SUBSETSTR_KANBUN
+{
+ Text [ en-US ] = "Kanbun";
+ };
+
+String RID_SUBSETSTR_BOPOMOFO_EXTENDED
+{
+ Text [ en-US ] = "Bopomofo Extended";
+ };
+
+String RID_SUBSETSTR_KATAKANA_PHONETIC
+{
+ Text [ en-US ] = "Katakana Phonetics";
+ };
+};
+
+// ********************************************************************** EOF
diff --git a/svx/source/dialog/wrapfield.cxx b/svx/source/dialog/wrapfield.cxx
new file mode 100644
index 000000000000..ee152439254c
--- /dev/null
+++ b/svx/source/dialog/wrapfield.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#include "svx/wrapfield.hxx"
+
+namespace svx {
+
+// ============================================================================
+
+WrapField::WrapField( Window* pParent, WinBits nWinStyle ) :
+ NumericField( pParent, nWinStyle )
+{
+}
+
+WrapField::WrapField( Window* pParent, const ResId& rResId ) :
+ NumericField( pParent, rResId )
+{
+}
+
+void WrapField::Up()
+{
+ SetValue( ((GetValue() + GetSpinSize() - GetMin()) % (GetMax() + 1)) + GetMin() );
+ GetUpHdl().Call( this );
+}
+
+void WrapField::Down()
+{
+ SetValue( ((GetValue() - GetSpinSize() + GetMax() + 1 - GetMin()) % (GetMax() + 1)) + GetMin() );
+ GetDownHdl().Call( this );
+}
+
+// ============================================================================
+
+} // namespace svx
+