diff options
Diffstat (limited to 'sc/source/ui/pagedlg')
-rw-r--r-- | sc/source/ui/pagedlg/areasdlg.cxx | 906 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/hfedtdlg.cxx | 186 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/hfedtdlg.hrc | 64 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/hfedtdlg.src | 829 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/makefile.mk | 74 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/pagedlg.hrc | 103 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/pagedlg.src | 416 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/scuitphfedit.cxx | 1001 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tphf.cxx | 331 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tphf.src | 64 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tphfedit.cxx | 874 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/tptable.cxx | 570 |
12 files changed, 5418 insertions, 0 deletions
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx new file mode 100644 index 000000000000..915355d5d0f2 --- /dev/null +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -0,0 +1,906 @@ +/************************************************************************* + * + * 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_sc.hxx" + + + +//---------------------------------------------------------------------------- +#include <rangelst.hxx> + +#include <sfx2/dispatch.hxx> +#include <svl/stritem.hxx> +#include <vcl/msgbox.hxx> +#include <unotools/charclass.hxx> +#include <stdlib.h> + +#define _AREASDLG_CXX +#include "areasdlg.hxx" +#undef _AREASDLG_CXX + +#include "scresid.hxx" +#include "rangenam.hxx" +#include "reffact.hxx" +#include "tabvwsh.hxx" +#include "docsh.hxx" +#include "globstr.hrc" +#include "pagedlg.hrc" +#include "compiler.hxx" + +// STATIC DATA --------------------------------------------------------------- + +// List box positions for print range (PR) +const USHORT SC_AREASDLG_PR_NONE = 0; +const USHORT SC_AREASDLG_PR_ENTIRE = 1; +const USHORT SC_AREASDLG_PR_USER = 2; +const USHORT SC_AREASDLG_PR_SELECT = 3; +const USHORT SC_AREASDLG_PR_OFFSET = 4; + +// List box positions for repeat ranges (RR) +const USHORT SC_AREASDLG_RR_NONE = 0; +const USHORT SC_AREASDLG_RR_USER = 1; +const USHORT SC_AREASDLG_RR_OFFSET = 2; + +//============================================================================ + +#define HDL(hdl) LINK( this, ScPrintAreasDlg, hdl ) +#define ERRORBOX(nId) ErrorBox( this, WinBits(WB_OK|WB_DEF_OK), \ + ScGlobal::GetRscString( nId ) ).Execute() +#define SWAP(x1,x2) { int n=x1; x1=x2; x2=n; } + +// globale Funktionen (->am Ende der Datei): + +bool lcl_CheckRepeatString( const String& rStr, ScDocument* pDoc, bool bIsRow, ScRange* pRange ); +void lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, bool bIsRow, String& rStr ); + +#if 0 +static void printAddressFlags(USHORT nFlag) +{ + if ((nFlag & SCA_COL_ABSOLUTE ) == SCA_COL_ABSOLUTE ) printf("SCA_COL_ABSOLUTE \n"); + if ((nFlag & SCA_ROW_ABSOLUTE ) == SCA_ROW_ABSOLUTE ) printf("SCA_ROW_ABSOLUTE \n"); + if ((nFlag & SCA_TAB_ABSOLUTE ) == SCA_TAB_ABSOLUTE ) printf("SCA_TAB_ABSOLUTE \n"); + if ((nFlag & SCA_TAB_3D ) == SCA_TAB_3D ) printf("SCA_TAB_3D \n"); + if ((nFlag & SCA_COL2_ABSOLUTE ) == SCA_COL2_ABSOLUTE ) printf("SCA_COL2_ABSOLUTE\n"); + if ((nFlag & SCA_ROW2_ABSOLUTE ) == SCA_ROW2_ABSOLUTE ) printf("SCA_ROW2_ABSOLUTE\n"); + if ((nFlag & SCA_TAB2_ABSOLUTE ) == SCA_TAB2_ABSOLUTE ) printf("SCA_TAB2_ABSOLUTE\n"); + if ((nFlag & SCA_TAB2_3D ) == SCA_TAB2_3D ) printf("SCA_TAB2_3D \n"); + if ((nFlag & SCA_VALID_ROW ) == SCA_VALID_ROW ) printf("SCA_VALID_ROW \n"); + if ((nFlag & SCA_VALID_COL ) == SCA_VALID_COL ) printf("SCA_VALID_COL \n"); + if ((nFlag & SCA_VALID_TAB ) == SCA_VALID_TAB ) printf("SCA_VALID_TAB \n"); + if ((nFlag & SCA_FORCE_DOC ) == SCA_FORCE_DOC ) printf("SCA_FORCE_DOC \n"); + if ((nFlag & SCA_VALID_ROW2 ) == SCA_VALID_ROW2 ) printf("SCA_VALID_ROW2 \n"); + if ((nFlag & SCA_VALID_COL2 ) == SCA_VALID_COL2 ) printf("SCA_VALID_COL2 \n"); + if ((nFlag & SCA_VALID_TAB2 ) == SCA_VALID_TAB2 ) printf("SCA_VALID_TAB2 \n"); + if ((nFlag & SCA_VALID ) == SCA_VALID ) printf("SCA_VALID \n"); + if ((nFlag & SCA_ABS ) == SCA_ABS ) printf("SCA_ABS \n"); + if ((nFlag & SCR_ABS ) == SCR_ABS ) printf("SCR_ABS \n"); + if ((nFlag & SCA_ABS_3D ) == SCA_ABS_3D ) printf("SCA_ABS_3D \n"); + if ((nFlag & SCR_ABS_3D ) == SCR_ABS_3D ) printf("SCR_ABS_3D \n"); +} +#endif + +//============================================================================ +// class ScPrintAreasDlg + +//---------------------------------------------------------------------------- + +ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent ) + : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_AREAS), + // + aLbPrintArea ( this, ScResId( LB_PRINTAREA ) ), + aFlPrintArea ( this, ScResId( FL_PRINTAREA ) ), + aEdPrintArea ( this, this, ScResId( ED_PRINTAREA ) ), + aRbPrintArea ( this, ScResId( RB_PRINTAREA ), &aEdPrintArea, this ), + // + aLbRepeatRow ( this, ScResId( LB_REPEATROW ) ), + aFlRepeatRow ( this, ScResId( FL_REPEATROW ) ), + aEdRepeatRow ( this, this, ScResId( ED_REPEATROW ) ), + aRbRepeatRow ( this, ScResId( RB_REPEATROW ), &aEdRepeatRow, this ), + // + aLbRepeatCol ( this, ScResId( LB_REPEATCOL ) ), + aFlRepeatCol ( this, ScResId( FL_REPEATCOL ) ), + aEdRepeatCol ( this, this, ScResId( ED_REPEATCOL ) ), + aRbRepeatCol ( this, ScResId( RB_REPEATCOL ), &aEdRepeatCol, this ), + // + aBtnOk ( this, ScResId( BTN_OK ) ), + aBtnCancel ( this, ScResId( BTN_CANCEL ) ), + aBtnHelp ( this, ScResId( BTN_HELP ) ), + // + bDlgLostFocus ( FALSE ), + pRefInputEdit ( &aEdPrintArea ), + pDoc ( NULL ), + pViewData ( NULL ), + nCurTab ( 0 ) +{ + ScTabViewShell* pScViewSh = PTR_CAST( ScTabViewShell, SfxViewShell::Current() ); + ScDocShell* pScDocSh = PTR_CAST( ScDocShell, SfxObjectShell::Current() ); + + DBG_ASSERT( pScDocSh, "Current DocumentShell not found :-(" ); + + pDoc = pScDocSh->GetDocument(); + + if ( pScViewSh ) + { + pViewData = pScViewSh->GetViewData(); + nCurTab = pViewData->GetTabNo(); + } + + Impl_Reset(); + + //@BugID 54702 Enablen/Disablen nur noch in Basisklasse + //SFX_APPWINDOW->Enable(); + + FreeResource(); +} + + +//---------------------------------------------------------------------------- + +ScPrintAreasDlg::~ScPrintAreasDlg() +{ + // Extra-Data an ListBox-Entries abraeumen + ListBox* pLb[3] = { &aLbPrintArea, &aLbRepeatRow, &aLbRepeatCol }; + + for ( USHORT i=0; i<3; i++ ) + { + USHORT nCount = pLb[i]->GetEntryCount(); + for ( USHORT j=0; j<nCount; j++ ) + delete (String*)pLb[i]->GetEntryData(j); + } +} + + +//---------------------------------------------------------------------------- + +BOOL ScPrintAreasDlg::Close() +{ + return DoClose( ScPrintAreasDlgWrapper::GetChildWindowId() ); +} + + +//---------------------------------------------------------------------------- + +BOOL ScPrintAreasDlg::IsTableLocked() const +{ + // Druckbereiche gelten pro Tabelle, darum macht es keinen Sinn, + // bei der Eingabe die Tabelle umzuschalten + + return TRUE; +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::SetReference( const ScRange& rRef, ScDocument* /* pDoc */ ) +{ + if ( pRefInputEdit ) + { + if ( rRef.aStart != rRef.aEnd ) + RefInputStart( pRefInputEdit ); + + String aStr; + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + + if ( &aEdPrintArea == pRefInputEdit ) + { + rRef.Format( aStr, SCR_ABS, pDoc, eConv ); + +// aEdPrintArea.ReplaceSelected( aStr ); + + String aVal = aEdPrintArea.GetText(); + Selection aSel = aEdPrintArea.GetSelection(); + aSel.Justify(); + aVal.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); + aVal.Insert( aStr, (xub_StrLen)aSel.Min() ); + Selection aNewSel( aSel.Min(), aSel.Min()+aStr.Len() ); + aEdPrintArea.SetRefString( aVal ); + aEdPrintArea.SetSelection( aNewSel ); + } + else + { + BOOL bRow = ( &aEdRepeatRow == pRefInputEdit ); + lcl_GetRepeatRangeString(&rRef, pDoc, bRow, aStr); + pRefInputEdit->SetRefString( aStr ); + } + } + + Impl_ModifyHdl( pRefInputEdit ); +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::AddRefEntry() +{ + if ( pRefInputEdit == &aEdPrintArea ) + { + const sal_Unicode sep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); + String aVal = aEdPrintArea.GetText(); + aVal += sep; + aEdPrintArea.SetText(aVal); + + xub_StrLen nLen = aVal.Len(); + aEdPrintArea.SetSelection( Selection( nLen, nLen ) ); + + Impl_ModifyHdl( &aEdPrintArea ); + } +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::Deactivate() +{ + bDlgLostFocus = TRUE; +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::SetActive() +{ + if ( bDlgLostFocus ) + { + bDlgLostFocus = FALSE; + + if ( pRefInputEdit ) + { + pRefInputEdit->GrabFocus(); + Impl_ModifyHdl( pRefInputEdit ); + } + } + else + GrabFocus(); + + RefInputDone(); +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::Impl_Reset() +{ + String aStrRange; + const ScRange* pRepeatColRange = pDoc->GetRepeatColRange( nCurTab ); + const ScRange* pRepeatRowRange = pDoc->GetRepeatRowRange( nCurTab ); + + aEdPrintArea.SetModifyHdl ( HDL(Impl_ModifyHdl) ); + aEdRepeatRow.SetModifyHdl ( HDL(Impl_ModifyHdl) ); + aEdRepeatCol.SetModifyHdl ( HDL(Impl_ModifyHdl) ); + aEdPrintArea.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aEdRepeatRow.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aEdRepeatCol.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aLbPrintArea.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aLbRepeatRow.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aLbRepeatCol.SetGetFocusHdl( HDL(Impl_GetFocusHdl) ); + aLbPrintArea.SetSelectHdl ( HDL(Impl_SelectHdl) ); + aLbRepeatRow.SetSelectHdl ( HDL(Impl_SelectHdl) ); + aLbRepeatCol.SetSelectHdl ( HDL(Impl_SelectHdl) ); + aBtnOk .SetClickHdl ( HDL(Impl_BtnHdl) ); + aBtnCancel .SetClickHdl ( HDL(Impl_BtnHdl) ); + + Impl_FillLists(); + + //------------------------- + // Druckbereich + //------------------------- + aStrRange.Erase(); + String aOne; + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const sal_Unicode sep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); + USHORT nRangeCount = pDoc->GetPrintRangeCount( nCurTab ); + for (USHORT i=0; i<nRangeCount; i++) + { + const ScRange* pPrintRange = pDoc->GetPrintRange( nCurTab, i ); + if (pPrintRange) + { + if ( aStrRange.Len() ) + aStrRange += sep; + pPrintRange->Format( aOne, SCR_ABS, pDoc, eConv ); + aStrRange += aOne; + } + } + aEdPrintArea.SetText( aStrRange ); + + //------------------------------- + // Wiederholungszeile + //------------------------------- + lcl_GetRepeatRangeString(pRepeatRowRange, pDoc, true, aStrRange); + aEdRepeatRow.SetText( aStrRange ); + + //-------------------------------- + // Wiederholungsspalte + //-------------------------------- + lcl_GetRepeatRangeString(pRepeatColRange, pDoc, false, aStrRange); + aEdRepeatCol.SetText( aStrRange ); + + Impl_ModifyHdl( &aEdPrintArea ); + Impl_ModifyHdl( &aEdRepeatRow ); + Impl_ModifyHdl( &aEdRepeatCol ); + if( pDoc->IsPrintEntireSheet( nCurTab ) ) + aLbPrintArea.SelectEntryPos( SC_AREASDLG_PR_ENTIRE ); + + aEdPrintArea.SaveValue(); // fuer FillItemSet() merken: + aEdRepeatRow.SaveValue(); + aEdRepeatCol.SaveValue(); +} + + +//---------------------------------------------------------------------------- + +BOOL ScPrintAreasDlg::Impl_GetItem( Edit* pEd, SfxStringItem& rItem ) +{ + String aRangeStr = pEd->GetText(); + BOOL bDataChanged = (pEd->GetSavedValue() != aRangeStr); + + if ( (aRangeStr.Len() > 0) && &aEdPrintArea != pEd ) + { + ScRange aRange; + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + lcl_CheckRepeatString(aRangeStr, pDoc, &aEdRepeatRow == pEd, &aRange); + aRange.Format(aRangeStr, SCR_ABS, pDoc, eConv); + } + + rItem.SetValue( aRangeStr ); + + return bDataChanged; +} + + +//---------------------------------------------------------------------------- + +BOOL ScPrintAreasDlg::Impl_CheckRefStrings() +{ + BOOL bOk = FALSE; + String aStrPrintArea = aEdPrintArea.GetText(); + String aStrRepeatRow = aEdRepeatRow.GetText(); + String aStrRepeatCol = aEdRepeatCol.GetText(); + + BOOL bPrintAreaOk = TRUE; + if ( aStrPrintArea.Len() ) + { + const USHORT nValidAddr = SCA_VALID | SCA_VALID_ROW | SCA_VALID_COL; + const USHORT nValidRange = nValidAddr | SCA_VALID_ROW2 | SCA_VALID_COL2; + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const sal_Unicode sep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); + // const sal_Unicode rsep = ScCompiler::GetNativeSymbol(ocRange).GetChar(0); + + ScAddress aAddr; + ScRange aRange; + xub_StrLen nSepCount = aStrPrintArea.GetTokenCount(sep); + for ( xub_StrLen i = 0; i < nSepCount && bPrintAreaOk; ++i ) + { + String aOne = aStrPrintArea.GetToken(i, sep); + USHORT nResult = aRange.Parse( aOne, pDoc, eConv ); + if ((nResult & nValidRange) != nValidRange) + { + USHORT nAddrResult = aAddr.Parse( aOne, pDoc, eConv ); + if ((nAddrResult & nValidAddr) != nValidAddr) + bPrintAreaOk = FALSE; + } + } + } + + BOOL bRepeatRowOk = (aStrRepeatRow.Len() == 0); + if ( !bRepeatRowOk ) + bRepeatRowOk = lcl_CheckRepeatString(aStrRepeatRow, pDoc, true, NULL); + + BOOL bRepeatColOk = (aStrRepeatCol.Len() == 0); + if ( !bRepeatColOk ) + bRepeatColOk = lcl_CheckRepeatString(aStrRepeatCol, pDoc, false, NULL); + + // Fehlermeldungen + + bOk = (bPrintAreaOk && bRepeatRowOk && bRepeatColOk); + + if ( !bOk ) + { + Edit* pEd = NULL; + + if ( !bPrintAreaOk ) pEd = &aEdPrintArea; + else if ( !bRepeatRowOk ) pEd = &aEdRepeatRow; + else if ( !bRepeatColOk ) pEd = &aEdRepeatCol; + + ERRORBOX( STR_INVALID_TABREF ); + pEd->GrabFocus(); + } + + return bOk; +} + + +//---------------------------------------------------------------------------- + +void ScPrintAreasDlg::Impl_FillLists() +{ + //------------------------------------------------------ + // Selektion holen und String in PrintArea-ListBox merken + //------------------------------------------------------ + ScRange aRange; + String aStrRange; + BOOL bSimple = TRUE; + + if ( pViewData ) + bSimple = (pViewData->GetSimpleArea( aRange ) == SC_MARK_SIMPLE); + + formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + + if ( bSimple ) + aRange.Format( aStrRange, SCR_ABS, pDoc, eConv ); + else + { + ScRangeListRef aList( new ScRangeList ); + pViewData->GetMarkData().FillRangeListWithMarks( aList, FALSE ); + aList->Format( aStrRange, SCR_ABS, pDoc, eConv ); + } + + aLbPrintArea.SetEntryData( SC_AREASDLG_PR_SELECT, new String( aStrRange ) ); + + //------------------------------------------------------ + // Ranges holen und in ListBoxen merken + //------------------------------------------------------ + ScRangeName* pRangeNames = pDoc->GetRangeName(); + const USHORT nCount = pRangeNames ? pRangeNames->GetCount() : 0; + + if ( nCount > 0 ) + { + String aName; + String aSymbol; +// ScRange aRange; + ScRangeData* pData = NULL; + + for ( USHORT i=0; i<nCount; i++ ) + { + pData = (ScRangeData*)(pRangeNames->At( i )); + if ( pData ) + { + if ( pData->HasType( RT_ABSAREA ) + || pData->HasType( RT_REFAREA ) + || pData->HasType( RT_ABSPOS ) ) + { + pData->GetName( aName ); + pData->GetSymbol( aSymbol ); + if ( aRange.ParseAny( aSymbol, pDoc, eConv ) & SCA_VALID ) + { + if ( pData->HasType( RT_PRINTAREA ) ) + { + aRange.Format( aSymbol, SCR_ABS, pDoc, eConv ); + aLbPrintArea.SetEntryData( + aLbPrintArea.InsertEntry( aName ), + new String( aSymbol ) ); + } + + if ( pData->HasType( RT_ROWHEADER ) ) + { + lcl_GetRepeatRangeString(&aRange, pDoc, true, aSymbol); + aLbRepeatRow.SetEntryData( + aLbRepeatRow.InsertEntry( aName ), + new String( aSymbol ) ); + } + + if ( pData->HasType( RT_COLHEADER ) ) + { + lcl_GetRepeatRangeString(&aRange, pDoc, false, aSymbol); + aLbRepeatCol.SetEntryData( + aLbRepeatCol.InsertEntry( aName ), + new String( aSymbol ) ); + } + } + } + } + } + } +} + + +//---------------------------------------------------------------------------- +// Handler: +//---------------------------------------------------------------------------- + +IMPL_LINK( ScPrintAreasDlg, Impl_BtnHdl, PushButton*, pBtn ) +{ + if ( &aBtnOk == pBtn ) + { + if ( Impl_CheckRefStrings() ) + { + BOOL bDataChanged = FALSE; + String aStr; + SfxStringItem aPrintArea( SID_CHANGE_PRINTAREA, aStr ); + SfxStringItem aRepeatRow( FN_PARAM_2, aStr ); + SfxStringItem aRepeatCol( FN_PARAM_3, aStr ); + + //------------------------- + // Druckbereich veraendert? + //------------------------- + + // first try the list box, if "Entite sheet" is selected + BOOL bEntireSheet = (aLbPrintArea.GetSelectEntryPos() == SC_AREASDLG_PR_ENTIRE); + SfxBoolItem aEntireSheet( FN_PARAM_4, bEntireSheet ); + + bDataChanged = bEntireSheet != pDoc->IsPrintEntireSheet( nCurTab ); + if( !bEntireSheet ) + { + // if new list box selection is not "Entire sheet", get the edit field contents + bDataChanged |= Impl_GetItem( &aEdPrintArea, aPrintArea ); + } + + //------------------------------- + // Wiederholungszeile veraendert? + //------------------------------- + bDataChanged |= Impl_GetItem( &aEdRepeatRow, aRepeatRow ); + + //-------------------------------- + // Wiederholungsspalte veraendert? + //-------------------------------- + bDataChanged |= Impl_GetItem( &aEdRepeatCol, aRepeatCol ); + + if ( bDataChanged ) + { + SetDispatcherLock( FALSE ); + SwitchToDocument(); + GetBindings().GetDispatcher()->Execute( SID_CHANGE_PRINTAREA, + SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, + &aPrintArea, &aRepeatRow, &aRepeatCol, &aEntireSheet, 0L ); + } + + Close(); + } + } + else if ( &aBtnCancel == pBtn ) + Close(); + + return 0; +} + + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScPrintAreasDlg, Impl_GetFocusHdl, Control*, pCtr ) +{ + if ( pCtr ==(Control *) &aEdPrintArea || + pCtr ==(Control *) &aEdRepeatRow || + pCtr ==(Control *) &aEdRepeatCol) + { + pRefInputEdit = (formula::RefEdit*) pCtr; + } + else if ( pCtr ==(Control *) &aLbPrintArea) + { + pRefInputEdit = &aEdPrintArea; + } + else if ( pCtr ==(Control *) &aLbRepeatRow) + { + pRefInputEdit = &aEdRepeatRow; + } + else if ( pCtr ==(Control *) &aLbRepeatCol) + { + pRefInputEdit = &aEdRepeatCol; + } + + return 0; +} + + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScPrintAreasDlg, Impl_SelectHdl, ListBox*, pLb ) +{ + USHORT nSelPos = pLb->GetSelectEntryPos(); + Edit* pEd = NULL; + + // list box positions of specific entries, default to "repeat row/column" list boxes + USHORT nAllSheetPos = SC_AREASDLG_RR_NONE; + USHORT nUserDefPos = SC_AREASDLG_RR_USER; + USHORT nFirstCustomPos = SC_AREASDLG_RR_OFFSET; + + // find edit field for list box, and list box positions + if( pLb == &aLbPrintArea ) + { + pEd = &aEdPrintArea; + nAllSheetPos = SC_AREASDLG_PR_ENTIRE; + nUserDefPos = SC_AREASDLG_PR_USER; + nFirstCustomPos = SC_AREASDLG_PR_SELECT; // "Selection" and following + } + else if( pLb == &aLbRepeatCol ) + pEd = &aEdRepeatCol; + else if( pLb == &aLbRepeatRow ) + pEd = &aEdRepeatRow; + else + return 0; + + // fill edit field according to list box selection + if( (nSelPos == 0) || (nSelPos == nAllSheetPos) ) + pEd->SetText( EMPTY_STRING ); + else if( nSelPos == nUserDefPos && !pLb->IsTravelSelect() && pEd->GetText().Len() == 0 ) + pLb->SelectEntryPos( 0 ); + else if( nSelPos >= nFirstCustomPos ) + pEd->SetText( *static_cast< String* >( pLb->GetEntryData( nSelPos ) ) ); + + return 0; +} + + +//---------------------------------------------------------------------------- + +IMPL_LINK( ScPrintAreasDlg, Impl_ModifyHdl, formula::RefEdit*, pEd ) +{ + ListBox* pLb = NULL; + + // list box positions of specific entries, default to "repeat row/column" list boxes + USHORT nUserDefPos = SC_AREASDLG_RR_USER; + USHORT nFirstCustomPos = SC_AREASDLG_RR_OFFSET; + + if( pEd == &aEdPrintArea ) + { + pLb = &aLbPrintArea; + nUserDefPos = SC_AREASDLG_PR_USER; + nFirstCustomPos = SC_AREASDLG_PR_SELECT; // "Selection" and following + } + else if( pEd == &aEdRepeatCol ) + pLb = &aLbRepeatCol; + else if( pEd == &aEdRepeatRow ) + pLb = &aLbRepeatRow; + else + return 0; + + // set list box selection according to edit field + USHORT nEntryCount = pLb->GetEntryCount(); + String aStrEd( pEd->GetText() ); + String aEdUpper = aStrEd; + aEdUpper.ToUpperAscii(); + + if ( (nEntryCount > nFirstCustomPos) && aStrEd.Len() > 0 ) + { + BOOL bFound = FALSE; + String* pSymbol = NULL; + USHORT i; + + for ( i=nFirstCustomPos; i<nEntryCount && !bFound; i++ ) + { + pSymbol = (String*)pLb->GetEntryData( i ); + bFound = ( (*pSymbol == aStrEd) || (*pSymbol == aEdUpper) ); + } + + pLb->SelectEntryPos( bFound ? i-1 : nUserDefPos ); + } + else + pLb->SelectEntryPos( aStrEd.Len() ? nUserDefPos : 0 ); + + return 0; +} + + +//============================================================================ +// globale Funktionen: + +// ---------------------------------------------------------------------------- + +// TODO: It might make sense to move these functions to address.?xx. -kohei + +bool lcl_CheckOne_OOO( const String& rStr, bool bIsRow, SCCOLROW& rVal ) +{ + // Zulaessige Syntax fuer rStr: + // Row: [$]1-MAXTAB + // Col: [$]A-IV + + String aStr = rStr; + xub_StrLen nLen = aStr.Len(); + SCCOLROW nNum = 0; + BOOL bStrOk = ( nLen > 0 ) && ( bIsRow ? ( nLen < 6 ) : ( nLen < 4 ) ); + + if ( bStrOk ) + { + if ( '$' == aStr.GetChar(0) ) + aStr.Erase( 0, 1 ); + + if ( bIsRow ) + { + bStrOk = CharClass::isAsciiNumeric(aStr); + + if ( bStrOk ) + { + sal_Int32 n = aStr.ToInt32(); + + if ( ( bStrOk = (n > 0) && ( n <= MAXROWCOUNT ) ) != FALSE ) + nNum = static_cast<SCCOLROW>(n - 1); + } + } + else + { + SCCOL nCol = 0; + bStrOk = ::AlphaToCol( nCol, aStr); + nNum = nCol; + } + } + + if ( bStrOk ) + rVal = nNum; + + return bStrOk; +} + +bool lcl_CheckOne_XL_A1( const String& rStr, bool bIsRow, SCCOLROW& rVal ) +{ + // XL A1 style is identical to OOO one for print range formats. + return lcl_CheckOne_OOO(rStr, bIsRow, rVal); +} + +bool lcl_CheckOne_XL_R1C1( const String& rStr, bool bIsRow, SCCOLROW& rVal ) +{ + xub_StrLen nLen = rStr.Len(); + if (nLen <= 1) + // There must be at least two characters. + return false; + + const sal_Unicode preUpper = bIsRow ? 'R' : 'C'; + const sal_Unicode preLower = bIsRow ? 'r' : 'c'; + if (rStr.GetChar(0) != preUpper && rStr.GetChar(0) != preLower) + return false; + + String aNumStr = rStr.Copy(1); + if (!CharClass::isAsciiNumeric(aNumStr)) + return false; + + sal_Int32 nNum = aNumStr.ToInt32(); + + if (nNum <= 0) + return false; + + if ((bIsRow && nNum > MAXROWCOUNT) || (!bIsRow && nNum > MAXCOLCOUNT)) + return false; + + rVal = static_cast<SCCOLROW>(nNum-1); + return true; +} + +bool lcl_CheckRepeatOne( const String& rStr, formula::FormulaGrammar::AddressConvention eConv, bool bIsRow, SCCOLROW& rVal ) +{ + switch (eConv) + { + case formula::FormulaGrammar::CONV_OOO: + return lcl_CheckOne_OOO(rStr, bIsRow, rVal); + case formula::FormulaGrammar::CONV_XL_A1: + return lcl_CheckOne_XL_A1(rStr, bIsRow, rVal); + case formula::FormulaGrammar::CONV_XL_R1C1: + return lcl_CheckOne_XL_R1C1(rStr, bIsRow, rVal); + default: + { + // added to avoid warnings + } + } + return false; +} + +bool lcl_CheckRepeatString( const String& rStr, ScDocument* pDoc, bool bIsRow, ScRange* pRange ) +{ + // Row: [valid row] rsep [valid row] + // Col: [valid col] rsep [valid col] + + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const sal_Unicode rsep = ScCompiler::GetNativeSymbol(ocRange).GetChar(0); + + if (pRange) + { + // initialize the range value. + pRange->aStart.SetCol(0); + pRange->aStart.SetRow(0); + pRange->aEnd.SetCol(0); + pRange->aEnd.SetRow(0); + } + + String aBuf; + SCCOLROW nVal = 0; + xub_StrLen nLen = rStr.Len(); + bool bEndPos = false; + for (xub_StrLen i = 0; i < nLen; ++i) + { + const sal_Unicode c = rStr.GetChar(i); + if (c == rsep) + { + if (bEndPos) + // We aren't supposed to have more than one range separator. + return false; + + // range separator + if (aBuf.Len() == 0) + return false; + + bool bRes = lcl_CheckRepeatOne(aBuf, eConv, bIsRow, nVal); + if (!bRes) + return false; + + if (pRange) + { + if (bIsRow) + { + pRange->aStart.SetRow(static_cast<SCROW>(nVal)); + pRange->aEnd.SetRow(static_cast<SCROW>(nVal)); + } + else + { + pRange->aStart.SetCol(static_cast<SCCOL>(nVal)); + pRange->aEnd.SetCol(static_cast<SCCOL>(nVal)); + } + } + + aBuf.Erase(); + bEndPos = true; + } + else + aBuf.Append(c); + } + + if (aBuf.Len() > 0) + { + bool bRes = lcl_CheckRepeatOne(aBuf, eConv, bIsRow, nVal); + if (!bRes) + return false; + + if (pRange) + { + if (bIsRow) + { + if (!bEndPos) + pRange->aStart.SetRow(static_cast<SCROW>(nVal)); + pRange->aEnd.SetRow(static_cast<SCROW>(nVal)); + } + else + { + if (!bEndPos) + pRange->aStart.SetCol(static_cast<SCCOL>(nVal)); + pRange->aEnd.SetCol(static_cast<SCCOL>(nVal)); + } + } + } + + return true; +} + +// ---------------------------------------------------------------------------- + +void lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, bool bIsRow, String& rStr ) +{ + rStr.Erase(); + if (!pRange) + return; + + const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const ScAddress& rStart = pRange->aStart; + const ScAddress& rEnd = pRange->aEnd; + + const USHORT nFmt = bIsRow ? (SCA_VALID_ROW | SCA_ROW_ABSOLUTE) : (SCA_VALID_COL | SCA_COL_ABSOLUTE); + String aTmpStr; + rStart.Format(aTmpStr, nFmt, pDoc, eConv); + rStr += aTmpStr; + if ((bIsRow && rStart.Row() != rEnd.Row()) || (!bIsRow && rStart.Col() != rEnd.Col())) + { + rStr += ScCompiler::GetNativeSymbol(ocRange); + rEnd.Format(aTmpStr, nFmt, pDoc, eConv); + rStr += aTmpStr; + } +} + diff --git a/sc/source/ui/pagedlg/hfedtdlg.cxx b/sc/source/ui/pagedlg/hfedtdlg.cxx new file mode 100644 index 000000000000..52527d3f60ce --- /dev/null +++ b/sc/source/ui/pagedlg/hfedtdlg.cxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * 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_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + + + +//------------------------------------------------------------------ + +#include "scitems.hxx" +#include <svl/eitem.hxx> + +#include "hfedtdlg.hxx" +#include "global.hxx" +#include "globstr.hrc" +//CHINA001 #include "tphfedit.hxx" +#include "scresid.hxx" +#include "hfedtdlg.hrc" +#include "scuitphfedit.hxx" //CHINA001 +//------------------------------------------------------------------ + +// macros from docsh4.cxx +//! use SIDs? + +#define IS_SHARE_HEADER(set) \ + ((SfxBoolItem&) \ + ((SvxSetItem&)(set).Get(ATTR_PAGE_HEADERSET)).GetItemSet(). \ + Get(ATTR_PAGE_SHARED)).GetValue() + +#define IS_SHARE_FOOTER(set) \ + ((SfxBoolItem&) \ + ((SvxSetItem&)(set).Get(ATTR_PAGE_FOOTERSET)).GetItemSet(). \ + Get(ATTR_PAGE_SHARED)).GetValue() + +//================================================================== + +ScHFEditDlg::ScHFEditDlg( SfxViewFrame* pFrameP, + Window* pParent, + const SfxItemSet& rCoreSet, + const String& rPageStyle, + USHORT nResIdP ) + : SfxTabDialog( pFrameP, pParent, ScResId( nResIdP ), &rCoreSet ) +{ + eNumType = ((const SvxPageItem&)rCoreSet.Get(ATTR_PAGE)).GetNumType(); + + String aTmp = GetText(); + + aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" )); + aTmp += ScGlobal::GetRscString( STR_PAGESTYLE ); + aTmp.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " )); + aTmp += rPageStyle; + aTmp += ')'; + SetText( aTmp ); + + switch ( nResIdP ) + { + case RID_SCDLG_HFED_HEADER: + case RID_SCDLG_HFEDIT_HEADER: + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFED_FOOTER: + case RID_SCDLG_HFEDIT_FOOTER: + AddTabPage( 1, ScRightFooterEditPage::Create, NULL ); + AddTabPage( 2, ScLeftFooterEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_LEFTHEADER: + AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_RIGHTHEADER: + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_LEFTFOOTER: + AddTabPage( 1, ScLeftFooterEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_RIGHTFOOTER: + AddTabPage( 1, ScRightFooterEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_SHDR: + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + AddTabPage( 2, ScRightFooterEditPage::Create, NULL ); + AddTabPage( 3, ScLeftFooterEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_SFTR: + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL ); + AddTabPage( 3, ScRightFooterEditPage::Create, NULL ); + break; + + case RID_SCDLG_HFEDIT_ALL: + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + AddTabPage( 2, ScLeftHeaderEditPage::Create, NULL ); + AddTabPage( 3, ScRightFooterEditPage::Create, NULL ); + AddTabPage( 4, ScLeftFooterEditPage::Create, NULL ); + break; + + default: + case RID_SCDLG_HFEDIT: + { + const SvxPageItem& rPageItem = (const SvxPageItem&) + rCoreSet.Get( + rCoreSet.GetPool()->GetWhich(SID_ATTR_PAGE) ); + + BOOL bRightPage = ( SVX_PAGE_LEFT != + SvxPageUsage(rPageItem.GetPageUsage()) ); + + if ( bRightPage ) + { + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + AddTabPage( 2, ScRightFooterEditPage::Create, NULL ); + } + else + { + // #69193a# respect "shared" setting + + BOOL bShareHeader = IS_SHARE_HEADER(rCoreSet); + if ( bShareHeader ) + AddTabPage( 1, ScRightHeaderEditPage::Create, NULL ); + else + AddTabPage( 1, ScLeftHeaderEditPage::Create, NULL ); + + BOOL bShareFooter = IS_SHARE_FOOTER(rCoreSet); + if ( bShareFooter ) + AddTabPage( 2, ScRightFooterEditPage::Create, NULL ); + else + AddTabPage( 2, ScLeftFooterEditPage::Create, NULL ); + } + } + break; + } + + FreeResource(); +} + +// ----------------------------------------------------------------------- + +__EXPORT ScHFEditDlg::~ScHFEditDlg() +{ +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScHFEditDlg::PageCreated( USHORT /* nId */, SfxTabPage& rPage ) +{ + // kann ja nur ne ScHFEditPage sein... + + ((ScHFEditPage&)rPage).SetNumType(eNumType); +} + + + + diff --git a/sc/source/ui/pagedlg/hfedtdlg.hrc b/sc/source/ui/pagedlg/hfedtdlg.hrc new file mode 100644 index 000000000000..30e6f8ecae63 --- /dev/null +++ b/sc/source/ui/pagedlg/hfedtdlg.hrc @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 "sc.hrc" + +//#define RID_SCPAGE_HFEDIT 256 +//#define RID_SCDLG_HFEDIT 256 + +#define FT_LEFT 1 +#define FT_CENTER 2 +#define FT_RIGHT 3 +#define FT_INFO 4 +#define WND_LEFT 1 +#define WND_CENTER 2 +#define WND_RIGHT 3 +#define BTN_TEXT 1 +#define BTN_PAGE 2 +#define BTN_PAGES 3 +#define BTN_DATE 4 +#define BTN_TIME 5 +#define BTN_FILE 6 +#define BTN_TABLE 7 + +#define RID_POPUP_FCOMMAND 10 +#define FILE_COMMAND_TITEL 11 +#define FILE_COMMAND_FILENAME 12 +#define FILE_COMMAND_PATH 13 + +#define FL_INFO 14 + +#define IMG_TEXT_H 21 +#define IMG_PAGE_H 22 +#define IMG_PAGES_H 23 +#define IMG_DATE_H 24 +#define IMG_TIME_H 25 +#define IMG_FILE_H 26 +#define IMG_TABLE_H 27 +#define FT_HF_DEFINED 28 +#define LB_DEFINED 29 +#define FT_HF_CUSTOM 30 diff --git a/sc/source/ui/pagedlg/hfedtdlg.src b/sc/source/ui/pagedlg/hfedtdlg.src new file mode 100644 index 000000000000..1445636e8cc6 --- /dev/null +++ b/sc/source/ui/pagedlg/hfedtdlg.src @@ -0,0 +1,829 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +/* StarView ressource file */ +#include "hfedtdlg.hrc" +#define HFEDIT_DLGTITLE \ + Text [ en-US ] = "Headers/Footers" ; \ + +#define HEADER \ + Text [ en-US ] = "Header" ; \ + +#define FOOTER \ + Text [ en-US ] = "Footer" ; \ + +#define HEADER_RIGHT \ + Text [ en-US ] = "Header (right)" ; \ + +#define HEADER_LEFT \ + Text [ en-US ] = "Header (left)" ; \ + +#define FOOTER_RIGHT \ + Text [ en-US ] = "Footer (right)" ; \ + +#define FOOTER_LEFT \ + Text [ en-US ] = "Footer (left)" ; \ + + //------------------------------------------------------------------------ + // Bearbeiten vom Seitendialog aus aufgerufen + //------------------------------------------------------------------------ +TabDialog RID_SCDLG_HFED_HEADER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Text [ en-US ] = "Headers" ; + Moveable = TRUE ; + // Closeable = TRUE; + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_RIGHT + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + HEADER_LEFT + PageResID = HID_SCPAGE_HFED_HL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFED_FOOTER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Text [ en-US ] = "Footers" ; + Moveable = TRUE ; + // Closeable = TRUE; + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + FOOTER_RIGHT + PageResID = HID_SCPAGE_HFED_FR ; + }; + PageItem + { + Identifier = 2 ; + FOOTER_LEFT + PageResID = HID_SCPAGE_HFED_FL ; + }; + }; + }; +}; + //------------------------------------------------------------------------ + // Bearbeiten/Kopf-Fusszeile: + //------------------------------------------------------------------------ +TabDialog RID_SCDLG_HFEDIT_ALL +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_RIGHT + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + HEADER_LEFT + PageResID = HID_SCPAGE_HFED_HL ; + }; + PageItem + { + Identifier = 3 ; + FOOTER_RIGHT + PageResID = HID_SCPAGE_HFED_FR ; + }; + PageItem + { + Identifier = 4 ; + FOOTER_LEFT + PageResID = HID_SCPAGE_HFED_FL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_SHDR +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + FOOTER_RIGHT + PageResID = HID_SCPAGE_HFED_FR ; + }; + PageItem + { + Identifier = 3 ; + FOOTER_LEFT + PageResID = HID_SCPAGE_HFED_FL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_SFTR +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_RIGHT + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + HEADER_LEFT + PageResID = HID_SCPAGE_HFED_HL ; + }; + PageItem + { + Identifier = 3 ; + FOOTER + PageResID = HID_SCPAGE_HFED_FR ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + FOOTER + PageResID = HID_SCPAGE_HFED_FR ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_HEADER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_RIGHT + PageResID = HID_SCPAGE_HFED_HR ; + }; + PageItem + { + Identifier = 2 ; + HEADER_LEFT + PageResID = HID_SCPAGE_HFED_HL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_FOOTER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + FOOTER_RIGHT + PageResID = HID_SCPAGE_HFED_FR ; + }; + PageItem + { + Identifier = 2 ; + FOOTER_LEFT + PageResID = HID_SCPAGE_HFED_FL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_RIGHTHEADER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_RIGHT + PageResID = HID_SCPAGE_HFED_HR ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_LEFTHEADER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + HEADER_LEFT + PageResID = HID_SCPAGE_HFED_HL ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_RIGHTFOOTER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + FOOTER_RIGHT + PageResID = HID_SCPAGE_HFED_FR ; + }; + }; + }; +}; +TabDialog RID_SCDLG_HFEDIT_LEFTFOOTER +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 270 , 140 ) ; + Moveable = TRUE ; + // Closeable = TRUE; + HFEDIT_DLGTITLE + TabControl 1 + { + OutputSize = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 260 , 135 ) ; + PageList = + { + PageItem + { + Identifier = 1 ; + FOOTER_LEFT + PageResID = HID_SCPAGE_HFED_FL ; + }; + }; + }; +}; + //------------------------------------------------------------------------ + // ScTpHFEdit + //------------------------------------------------------------------------ +TabPage RID_HFBASE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_HFEDIT ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_LEFT + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "~Left area" ; + }; + /* "Control" braucht eigene HelpId, darum in der Ableitung: + Control WND_LEFT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; +*/ + FixedText FT_CENTER + { + Pos = MAP_APPFONT ( 90 , 6 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "~Center area" ; + }; + /* "Control" braucht eigene HelpId, darum in der Ableitung: + Control WND_CENTER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; +*/ + FixedText FT_RIGHT + { + Pos = MAP_APPFONT ( 174 , 6 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + Text [ en-US ] = "R~ight area" ; + }; + /* "Control" braucht eigene HelpId, darum in der Ableitung: + Control WND_RIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 174 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; +*/ + FixedText FT_HF_DEFINED + { + Pos = MAP_APPFONT ( 12 , 102 ) ; + Size = MAP_APPFONT ( 76 , 10 ) ; + Text [ en-US ] = "Hea~der" ; + }; + + /* #i84123# list box needs own help id, which is set in the derived tab pages + ListBox LB_DEFINED + { + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 100 ) ; + Size = MAP_APPFONT ( 130 , 80 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; + */ + + FixedText FT_HF_CUSTOM + { + Pos = MAP_APPFONT ( 12 , 124 ) ; + Size = MAP_APPFONT ( 76 , 10 ) ; + Text [ en-US ] = "Custom header" ; + }; + + ImageButton BTN_TEXT + { + HelpId = HID_SC_HF_TEXT ; + Pos = MAP_APPFONT ( 90 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Text Attributes" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "text.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_TEXT_H + { + ImageBitmap = Bitmap { File = "text_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + ImageButton BTN_FILE + { + HelpId = HID_SC_HF_FILE ; + Pos = MAP_APPFONT ( 113 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Title" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "file.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_FILE_H + { + ImageBitmap = Bitmap { File = "file_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + + Menu RID_POPUP_FCOMMAND + { + ItemList = + { + MenuItem + { + Identifier = FILE_COMMAND_TITEL ; + HelpID = HID_FCOMMAND_TITEL ; + Text [ en-US ] = "Title"; + }; + MenuItem + { + Identifier = FILE_COMMAND_FILENAME; + HelpID = HID_FCOMMAND_FILENAME; + RadioCheck = TRUE ; + Text [ en-US ] = "File Name"; + }; + MenuItem + { + Identifier = FILE_COMMAND_PATH; + HelpID = HID_FCOMMAND_PATH; + RadioCheck = TRUE ; + Text [ en-US ] = "Path/File Name"; + }; + }; + }; + + ImageButton BTN_TABLE + { + HelpId = HID_SC_HF_TABLE ; + Pos = MAP_APPFONT ( 130 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Sheet Name" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "table.bmp" ; }; + MaskColor = STD_MASKCOLOR; + }; + }; + Image IMG_TABLE_H + { + ImageBitmap = Bitmap { File = "table_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + ImageButton BTN_PAGE + { + HelpId = HID_SC_HF_PAGE ; + Pos = MAP_APPFONT ( 150 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Page" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "page.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_PAGE_H + { + ImageBitmap = Bitmap { File = "page_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + ImageButton BTN_PAGES + { + HelpId = HID_SC_HF_PAGES ; + Pos = MAP_APPFONT ( 167 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Pages" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "pages.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_PAGES_H + { + ImageBitmap = Bitmap { File = "pages_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + ImageButton BTN_DATE + { + HelpId = HID_SC_HF_DATE ; + Pos = MAP_APPFONT ( 187 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Date" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "date.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_DATE_H + { + ImageBitmap = Bitmap { File = "date_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + ImageButton BTN_TIME + { + HelpId = HID_SC_HF_TIME ; + Pos = MAP_APPFONT ( 204 , 122 ) ; + Size = MAP_APPFONT ( 15 , 15 ) ; + TabStop = TRUE ; + QuickHelpText [ en-US ] = "Time" ; + ButtonImage = Image + { + ImageBitmap = Bitmap { File = "time.bmp" ; }; + MaskColor = STD_MASKCOLOR ; + }; + }; + Image IMG_TIME_H + { + ImageBitmap = Bitmap { File = "time_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + FixedText FT_INFO + { + Pos = MAP_APPFONT ( 12 , 155 ) ; + Size = MAP_APPFONT ( 240 , 24 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Use the buttons to change the font or insert field commands such as date, time, etc." ; + }; + FixedLine FL_INFO + { + Pos = MAP_APPFONT ( 6 , 144 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Note" ; + }; +}; + // Kombinationen: Header/Footer links/rechts + // die Eingabefenster jeweils mit eigener ID, sonst aus RID_HFBASE kopiert +TabPage RID_SCPAGE_HFED_HL < RID_HFBASE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_HFED_HL ; + Control WND_LEFT + { + HelpId = HID_SC_HF_HLL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_CENTER + { + HelpId = HID_SC_HF_HLC ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_RIGHT + { + HelpId = HID_SC_HF_HLR ; + Border = TRUE ; + Pos = MAP_APPFONT ( 174 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + ListBox LB_DEFINED + { + HelpId = HID_SC_HF_HL_DEFINED ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 100 ) ; + Size = MAP_APPFONT ( 130 , 80 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; +}; +TabPage RID_SCPAGE_HFED_HR < RID_HFBASE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_HFED_HR ; + Control WND_LEFT + { + HelpId = HID_SC_HF_HRL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_CENTER + { + HelpId = HID_SC_HF_HRC ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_RIGHT + { + HelpId = HID_SC_HF_HRR ; + Border = TRUE ; + Pos = MAP_APPFONT ( 174 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + ListBox LB_DEFINED + { + HelpId = HID_SC_HF_HR_DEFINED ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 100 ) ; + Size = MAP_APPFONT ( 130 , 80 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; +}; +TabPage RID_SCPAGE_HFED_FL < RID_HFBASE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_HFED_FL ; + Control WND_LEFT + { + HelpId = HID_SC_HF_FLL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_CENTER + { + HelpId = HID_SC_HF_FLC ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_RIGHT + { + HelpId = HID_SC_HF_FLR ; + Border = TRUE ; + Pos = MAP_APPFONT ( 174 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + ListBox LB_DEFINED + { + HelpId = HID_SC_HF_FL_DEFINED ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 100 ) ; + Size = MAP_APPFONT ( 130 , 80 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; +}; +TabPage RID_SCPAGE_HFED_FR < RID_HFBASE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_HFED_FR ; + Control WND_LEFT + { + HelpId = HID_SC_HF_FRL ; + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_CENTER + { + HelpId = HID_SC_HF_FRC ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + Control WND_RIGHT + { + HelpId = HID_SC_HF_FRR ; + Border = TRUE ; + Pos = MAP_APPFONT ( 174 , 18 ) ; + Size = MAP_APPFONT ( 80 , 72 ) ; + TabStop = TRUE ; + }; + ListBox LB_DEFINED + { + HelpId = HID_SC_HF_FR_DEFINED ; + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 100 ) ; + Size = MAP_APPFONT ( 130 , 80 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; +}; + diff --git a/sc/source/ui/pagedlg/makefile.mk b/sc/source/ui/pagedlg/makefile.mk new file mode 100644 index 000000000000..500e642e79eb --- /dev/null +++ b/sc/source/ui/pagedlg/makefile.mk @@ -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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=sc +TARGET=pagedlg +LIBTARGET=no + +# --- Settings ----------------------------------------------------- + +.INCLUDE : scpre.mk +.INCLUDE : settings.mk +.INCLUDE : sc.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +CXXFILES = \ + areasdlg.cxx \ + hfedtdlg.cxx \ + tptable.cxx \ + tphf.cxx \ + tphfedit.cxx + + + +SLOFILES = \ + $(SLO)$/areasdlg.obj \ + $(SLO)$/hfedtdlg.obj \ + $(SLO)$/tptable.obj \ + $(SLO)$/tphf.obj \ + $(SLO)$/tphfedit.obj \ + $(SLO)$/scuitphfedit.obj + + +SRS1NAME=$(TARGET) +SRC1FILES = pagedlg.src \ + hfedtdlg.src \ + tphf.src + +LIB1TARGET = $(SLB)$/$(TARGET).lib + +LIB1OBJFILES = \ + $(SLO)$/areasdlg.obj \ + $(SLO)$/tphfedit.obj +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sc/source/ui/pagedlg/pagedlg.hrc b/sc/source/ui/pagedlg/pagedlg.hrc new file mode 100644 index 000000000000..2f3593c2f6d1 --- /dev/null +++ b/sc/source/ui/pagedlg/pagedlg.hrc @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 "sc.hrc" // -> RID_SCDLG_PAGE + // -> RID_SCPAGE_TABLE + // -> RID_SCPAGE_AREAS + +#define TP_PAGE_STD 1 +#define TP_PAGE_HEADER 2 +#define TP_PAGE_FOOTER 3 +#define TP_PAGE_TABLE 4 +#define TP_PAGE_AREAS 5 + +//================================================ +// TabPage: Tabelle + +#define BTN_GRID 10 +#define BTN_HEADER 11 +#define BTN_NOTES 12 +#define BTN_CHARTS 13 +#define BTN_OBJECTS 14 +#define BTN_DRAWINGS 15 +#define BTN_FORMULAS 16 +#define BTN_NULLVALS 17 +#define FL_PRINT 19 + +#define BTN_TOPDOWN 20 +#define BTN_LEFTRIGHT 21 +#define BMP_PAGEDIR 22 +#define IMG_LEFTRIGHT 23 +#define IMG_TOPDOWN 24 +#define BTN_PAGENO 25 +#define ED_PAGENO 26 +#define FL_PAGEDIR 29 + +#define FT_SCALEMODE 30 +#define LB_SCALEMODE 31 +#define ED_SCALEALL 32 +#define ED_SCALEPAGENUM 34 +#define ED_SCALEPAGEWIDTH 35 +#define ED_SCALEPAGEHEIGHT 36 +#define FL_SCALE 39 + +#define FT_SCALEFACTOR 51 +#define FT_SCALEPAGEWIDTH 52 +#define FT_SCALEPAGEHEIGHT 53 +#define FT_SCALEPAGENUM 54 + +#define IMG_LEFTRIGHT_H 41 +#define IMG_TOPDOWN_H 42 + +// List box entries "Scaling mode" +#define SC_TPTABLE_SCALE_PERCENT 0 +#define SC_TPTABLE_SCALE_TO 1 +#define SC_TPTABLE_SCALE_TO_PAGES 2 + +//================================================ +// Dialog: Druckbereiche + +#define FL_PRINTAREA 10 +#define ED_PRINTAREA 11 +#define RB_PRINTAREA 12 +#define LB_PRINTAREA 13 + +#define FL_REPEATROW 20 +#define ED_REPEATROW 21 +#define RB_REPEATROW 22 +#define LB_REPEATROW 23 + +#define FL_REPEATCOL 30 +#define ED_REPEATCOL 31 +#define RB_REPEATCOL 32 +#define LB_REPEATCOL 33 + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 + diff --git a/sc/source/ui/pagedlg/pagedlg.src b/sc/source/ui/pagedlg/pagedlg.src new file mode 100644 index 000000000000..d0f95c3d9f6b --- /dev/null +++ b/sc/source/ui/pagedlg/pagedlg.src @@ -0,0 +1,416 @@ +/************************************************************************* + * + * 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 "pagedlg.hrc" +ModelessDialog RID_SCDLG_AREAS +{ + HelpId = HID_SCPAGE_AREAS ; + Size = MAP_APPFONT ( 316 , 90 ) ; + OutputSize = TRUE ; + Moveable = TRUE ; + //Closeable = TRUE; // Dieser Dialog hat einen Cancel-Button ! + Hide = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Edit Print Ranges" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 260 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 260 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 260 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + FixedLine FL_PRINTAREA + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Print range" ; + }; + ListBox LB_PRINTAREA + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 90 , 60 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "- none -" ; Default ; > ; + < "- entire sheet -" ; Default ; > ; + < "- user defined -" ; Default ; > ; + < "- selection -" ; Default ; > ; + }; + }; + Edit ED_PRINTAREA + { + Border = TRUE ; + Pos = MAP_APPFONT ( 106 , 14 ) ; + Size = MAP_APPFONT ( 131 , 12 ) ; + }; + ImageButton RB_PRINTAREA + { + Pos = MAP_APPFONT ( 239 , 13 ) ; + Size = MAP_APPFONT ( 13 , 15 ) ; + TabStop = FALSE ; + QuickHelpText [ en-US ] = "Shrink" ; + }; + FixedLine FL_REPEATROW + { + Pos = MAP_APPFONT ( 6 , 32 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Rows to repeat" ; + }; + ListBox LB_REPEATROW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 90 , 60 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "- none -" ; Default ; > ; + < "- user defined -" ; Default ; > ; + }; + }; + Edit ED_REPEATROW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 106 , 43 ) ; + Size = MAP_APPFONT ( 131 , 12 ) ; + }; + ImageButton RB_REPEATROW + { + Pos = MAP_APPFONT ( 239 , 42 ) ; + Size = MAP_APPFONT ( 13 , 15 ) ; + TabStop = FALSE ; + QuickHelpText [ en-US ] = "Shrink" ; + }; + FixedLine FL_REPEATCOL + { + Pos = MAP_APPFONT ( 6 , 61 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Columns to repeat" ; + }; + ListBox LB_REPEATCOL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 72 ) ; + Size = MAP_APPFONT ( 90 , 60 ) ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "- none -" ; Default ; > ; + < "- user defined -" ; Default ; > ; + }; + }; + Edit ED_REPEATCOL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 106 , 72 ) ; + Size = MAP_APPFONT ( 131 , 12 ) ; + }; + ImageButton RB_REPEATCOL + { + Pos = MAP_APPFONT ( 239 , 71 ) ; + Size = MAP_APPFONT ( 13 , 15 ) ; + TabStop = FALSE ; + QuickHelpText [ en-US ] = "Shrink" ; + }; +}; +TabPage RID_SCPAGE_TABLE +{ + Hide = TRUE ; + HelpId = HID_SCPAGE_TABLE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + CheckBox BTN_HEADER + { + Pos = MAP_APPFONT ( 12 , 73 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Column and row headers" ; + TabStop = TRUE ; + }; + CheckBox BTN_GRID + { + Pos = MAP_APPFONT ( 12 , 87 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Grid" ; + TabStop = TRUE ; + }; + CheckBox BTN_NOTES + { + Pos = MAP_APPFONT ( 12 , 101 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Comments" ; + TabStop = TRUE ; + }; + CheckBox BTN_OBJECTS + { + Pos = MAP_APPFONT ( 12 , 115 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Objects/graphics" ; + TabStop = TRUE ; + }; + CheckBox BTN_CHARTS + { + Pos = MAP_APPFONT ( 160 , 73 ) ; + Size = MAP_APPFONT ( 91 , 10 ) ; + Text [ en-US ] = "Ch~arts" ; + TabStop = TRUE ; + }; + CheckBox BTN_DRAWINGS + { + Pos = MAP_APPFONT ( 160 , 87 ) ; + Size = MAP_APPFONT ( 91 , 10 ) ; + Text [ en-US ] = "~Drawing objects" ; + TabStop = TRUE ; + }; + CheckBox BTN_FORMULAS + { + Pos = MAP_APPFONT ( 160 , 101 ) ; + Size = MAP_APPFONT ( 91 , 10 ) ; + Text [ en-US ] = "~Formulas" ; + TabStop = TRUE ; + }; + CheckBox BTN_NULLVALS + { + Pos = MAP_APPFONT ( 160 , 115 ) ; + Size = MAP_APPFONT ( 91 , 10 ) ; + Text [ en-US ] = "Zero ~values" ; + TabStop = TRUE ; + }; + FixedLine FL_PRINT + { + Pos = MAP_APPFONT ( 6 , 62 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Print" ; + }; + RadioButton BTN_TOPDOWN + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Top to bottom, then right" ; + TabStop = TRUE ; + }; + RadioButton BTN_LEFTRIGHT + { + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 142 , 10 ) ; + Text [ en-US ] = "~Left to right, then down" ; + TabStop = TRUE ; + }; + FixedImage BMP_PAGEDIR + { + Pos = MAP_APPFONT ( 160 , 14 ) ; + Size = MAP_APPFONT ( 25 , 25 ) ; + }; + Image IMG_LEFTRIGHT + { + ImageBitmap = Bitmap { File = "lftrgt.bmp" ; }; + MaskColor = STD_MASKCOLOR; + }; + Image IMG_LEFTRIGHT_H + { + ImageBitmap = Bitmap { File = "lftrgt_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + Image IMG_TOPDOWN + { + ImageBitmap = Bitmap { File = "topdown.bmp" ; }; + MaskColor = STD_MASKCOLOR; + }; + Image IMG_TOPDOWN_H + { + ImageBitmap = Bitmap { File = "topdown_h.bmp" ; }; + MaskColor = SC_HC_MASKCOLOR; + }; + CheckBox BTN_PAGENO + { + Pos = MAP_APPFONT ( 12 , 46 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + Text [ en-US ] = "First ~page number" ; + TabStop = TRUE ; + }; + NumericField ED_PAGENO + { + Border = TRUE ; + Pos = MAP_APPFONT ( 106 , 44 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 9999 ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + FixedLine FL_PAGEDIR + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Page order" ; + }; + FixedText FT_SCALEMODE + { + Pos = MAP_APPFONT( 12, 144 ); + Size = MAP_APPFONT( 124, 8 ); + Text [ en-US ] = "Scaling ~mode"; + }; + ListBox LB_SCALEMODE + { + Border = TRUE; + Pos = MAP_APPFONT( 12, 155 ); + Size = MAP_APPFONT( 124, 60 ); + DropDown = TRUE; + StringList [ en-US ] = + { + < "Reduce/enlarge printout"; SC_TPTABLE_SCALE_PERCENT; >; + < "Fit print range(s) to width/height"; SC_TPTABLE_SCALE_TO; >; + < "Fit print range(s) on number of pages"; SC_TPTABLE_SCALE_TO_PAGES; >; + }; + }; + MetricField ED_SCALEALL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 218 , 155 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 10 ; + Maximum = 400 ; + First = 15 ; + Last = 200 ; + SpinSize = 1 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + }; + NumericField ED_SCALEPAGEWIDTH + { + Border = TRUE ; + Pos = MAP_APPFONT ( 218 , 144 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 1 ; + Maximum = 1000 ; + SpinSize = 1 ; + }; + NumericField ED_SCALEPAGEHEIGHT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 218 , 160 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 1 ; + Maximum = 1000 ; + SpinSize = 1 ; + }; + NumericField ED_SCALEPAGENUM + { + Border = TRUE ; + Pos = MAP_APPFONT ( 218 , 155 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 1 ; + Maximum = 1000 ; + SpinSize = 1 ; + }; + FixedText FT_SCALEFACTOR + { + Pos = MAP_APPFONT( 148, 157 ); + Size = MAP_APPFONT( 68 , 8 ); + Hide = TRUE; + Text [ en-US ] = "~Scaling factor"; + }; + FixedText FT_SCALEPAGEWIDTH + { + Pos = MAP_APPFONT( 148, 146 ); + Size = MAP_APPFONT( 68 , 8 ); + Hide = TRUE; + Text [ en-US ] = "~Width in pages"; + }; + FixedText FT_SCALEPAGEHEIGHT + { + Pos = MAP_APPFONT( 148, 162 ); + Size = MAP_APPFONT( 68 , 8 ); + Hide = TRUE; + Text [ en-US ] = "H~eight in pages"; + }; + FixedText FT_SCALEPAGENUM + { + Pos = MAP_APPFONT( 148, 157 ); + Size = MAP_APPFONT( 68, 8 ); + Hide = TRUE; + Text [ en-US ] = "N~umber of pages"; + }; + FixedLine FL_SCALE + { + Pos = MAP_APPFONT ( 6 , 131 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Scale" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx new file mode 100644 index 000000000000..ba89691239c3 --- /dev/null +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -0,0 +1,1001 @@ +/************************************************************************* + * + * 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_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + + + +//------------------------------------------------------------------ + +#define _TPHFEDIT_CXX +#include "scitems.hxx" +#include <editeng/eeitem.hxx> + +//CHINA001 #include <svx/chardlg.hxx> +#include <editeng/editobj.hxx> +#include <editeng/editstat.hxx> +#include <editeng/editview.hxx> +#include <editeng/flditem.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/objsh.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <unotools/useroptions.hxx> +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> + +//CHINA001 #include "tphfedit.hxx" +#include "editutil.hxx" +#include "global.hxx" +#include "attrib.hxx" +#include "patattr.hxx" +#include "scresid.hxx" +#include "sc.hrc" +#include "globstr.hrc" +#include "tabvwsh.hxx" +#include "prevwsh.hxx" +#include "hfedtdlg.hrc" +#include "textdlgs.hxx" +#include "AccessibleEditObject.hxx" + +#include "scuitphfedit.hxx" //CHINA001 +#include <memory> // header file for auto_ptr + +// STATIC DATA ----------------------------------------------------------- + +static USHORT pPageRightHeaderRanges[] = { SID_SCATTR_PAGE_HEADERRIGHT, + SID_SCATTR_PAGE_HEADERRIGHT, + 0 }; + +static USHORT pPageRightFooterRanges[] = { SID_SCATTR_PAGE_FOOTERRIGHT, + SID_SCATTR_PAGE_FOOTERRIGHT, + 0 }; + +static USHORT pPageLeftHeaderRanges[] = { SID_SCATTR_PAGE_HEADERLEFT, + SID_SCATTR_PAGE_HEADERLEFT, + 0 }; + +static USHORT pPageLeftFooterRanges[] = { SID_SCATTR_PAGE_FOOTERLEFT, + SID_SCATTR_PAGE_FOOTERLEFT, + 0 }; + + +static ScEditWindow* pActiveEdWnd = NULL; + + +//======================================================================== +// class ScHFEditPage +// + +ScHFEditPage::ScHFEditPage( Window* pParent, + USHORT nResId, + const SfxItemSet& rCoreAttrs, + USHORT nWhichId, + bool bHeader ) + + : SfxTabPage ( pParent, ScResId( nResId ), rCoreAttrs ), + + aFtLeft ( this, ScResId( FT_LEFT ) ), + aWndLeft ( this, ScResId( WND_LEFT ), Left ), + aFtCenter ( this, ScResId( FT_CENTER ) ), + aWndCenter ( this, ScResId( WND_CENTER ), Center ), + aFtRight ( this, ScResId( FT_RIGHT ) ), + aWndRight ( this, ScResId( WND_RIGHT ), Right ), + maFtDefinedHF ( this, ScResId( FT_HF_DEFINED ) ), + maLbDefined ( this, ScResId( LB_DEFINED ) ), + maFtCustomHF ( this, ScResId( FT_HF_CUSTOM ) ), + aBtnText ( this, ScResId( BTN_TEXT ) ), + aBtnFile ( this, ScResId( BTN_FILE ) ), + aBtnTable ( this, ScResId( BTN_TABLE ) ), + aBtnPage ( this, ScResId( BTN_PAGE ) ), + aBtnLastPage ( this, ScResId( BTN_PAGES ) ), + aBtnDate ( this, ScResId( BTN_DATE ) ), + aBtnTime ( this, ScResId( BTN_TIME ) ), + aFlInfo ( this, ScResId( FL_INFO ) ), + aFtInfo ( this, ScResId( FT_INFO ) ), + aPopUpFile ( ScResId( RID_POPUP_FCOMMAND) ), + nWhich ( nWhichId ) +{ + //! use default style from current document? + //! if font color is used, header/footer background color must be set + + ScPatternAttr aPatAttr( rCoreAttrs.GetPool() ); + + + aBtnFile.SetPopupMenu(&aPopUpFile); + + maLbDefined.SetSelectHdl( LINK( this, ScHFEditPage, ListHdl_Impl ) ); + aBtnFile.SetMenuHdl( LINK( this, ScHFEditPage, MenuHdl ) ); + aBtnText .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnPage .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnLastPage.SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnDate .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnTime .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnFile .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + aBtnTable .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); + + aBtnText .SetModeImage( Image( ScResId( IMG_TEXT_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnFile .SetModeImage( Image( ScResId( IMG_FILE_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnTable .SetModeImage( Image( ScResId( IMG_TABLE_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnPage .SetModeImage( Image( ScResId( IMG_PAGE_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnLastPage.SetModeImage( Image( ScResId( IMG_PAGES_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnDate .SetModeImage( Image( ScResId( IMG_DATE_H ) ), BMP_COLOR_HIGHCONTRAST ); + aBtnTime .SetModeImage( Image( ScResId( IMG_TIME_H ) ), BMP_COLOR_HIGHCONTRAST ); + + if(!bHeader) + { + maFtDefinedHF.SetText(ScGlobal::GetRscString( STR_FOOTER )); + maFtCustomHF.SetText(ScGlobal::GetRscString( STR_HF_CUSTOM_FOOTER )); + } + if( Application::GetSettings().GetLayoutRTL() ) + { + Point pt1 = aWndLeft.GetPosPixel(); + Point pt2 = aWndRight.GetPosPixel(); + aWndLeft.SetPosPixel(pt2); + aWndRight.SetPosPixel(pt1); + + pt1 = aFtLeft.GetPosPixel(); + pt2 = aFtRight.GetPosPixel(); + aFtLeft.SetPosPixel(pt2); + aFtRight.SetPosPixel(pt1); + } + aWndLeft. SetFont( aPatAttr ); + aWndCenter. SetFont( aPatAttr ); + aWndRight. SetFont( aPatAttr ); + + FillCmdArr(); + + aWndLeft.GrabFocus(); + + InitPreDefinedList(); + + FreeResource(); +} + +// ----------------------------------------------------------------------- + +__EXPORT ScHFEditPage::~ScHFEditPage() +{ +} + +void ScHFEditPage::SetNumType(SvxNumType eNumType) +{ + aWndLeft.SetNumType(eNumType); + aWndCenter.SetNumType(eNumType); + aWndRight.SetNumType(eNumType); +} + +// ----------------------------------------------------------------------- + +#define IS_AVAILABLE(w)(rCoreSet.GetItemState( (w) ) >= SFX_ITEM_AVAILABLE) + +void __EXPORT ScHFEditPage::Reset( const SfxItemSet& rCoreSet ) +{ + if ( IS_AVAILABLE( nWhich ) ) + { + const ScPageHFItem& rItem = (const ScPageHFItem&)(rCoreSet.Get( nWhich )); + + if( const EditTextObject* pLeft = rItem.GetLeftArea() ) + aWndLeft.SetText( *pLeft ); + if( const EditTextObject* pCenter = rItem.GetCenterArea() ) + aWndCenter.SetText( *pCenter ); + if( const EditTextObject* pRight = rItem.GetRightArea() ) + aWndRight.SetText( *pRight ); + + SetSelectDefinedList(); + } +} + +#undef IS_AVAILABLE + +// ----------------------------------------------------------------------- + +BOOL __EXPORT ScHFEditPage::FillItemSet( SfxItemSet& rCoreSet ) +{ + ScPageHFItem aItem( nWhich ); + EditTextObject* pLeft = aWndLeft .CreateTextObject(); + EditTextObject* pCenter = aWndCenter.CreateTextObject(); + EditTextObject* pRight = aWndRight .CreateTextObject(); + + aItem.SetLeftArea ( *pLeft ); + aItem.SetCenterArea( *pCenter ); + aItem.SetRightArea ( *pRight ); + delete pLeft; + delete pCenter; + delete pRight; + + rCoreSet.Put( aItem ); + + return TRUE; +} + +// ----------------------------------------------------------------------- + +#define SET_CMD(i,id) \ + aCmd = aDel; \ + aCmd += ScGlobal::GetRscString( id ); \ + aCmd += aDel; \ + aCmdArr[i] = aCmd; + +// ----------------------------------------------------------------------- + +void ScHFEditPage::FillCmdArr() +{ + String aDel( ScGlobal::GetRscString( STR_HFCMD_DELIMITER ) ); + String aCmd; + + SET_CMD( 0, STR_HFCMD_PAGE ) + SET_CMD( 1, STR_HFCMD_PAGES ) + SET_CMD( 2, STR_HFCMD_DATE ) + SET_CMD( 3, STR_HFCMD_TIME ) + SET_CMD( 4, STR_HFCMD_FILE ) + SET_CMD( 5, STR_HFCMD_TABLE ) +} + +#undef SET_CMD + +void ScHFEditPage::InitPreDefinedList() +{ + SvtUserOptions aUserOpt; + + Color* pTxtColour = NULL; + Color* pFldColour = NULL; + + // Get the all field values at the outset. + String aPageFieldValue(aWndLeft.GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour)); + String aSheetFieldValue(aWndLeft.GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour)); + String aFileFieldValue(aWndLeft.GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour)); + String aExtFileFieldValue(aWndLeft.GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxExtFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour)); + String aDateFieldValue(aWndLeft.GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxDateField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour)); + + maLbDefined.Clear(); + + maLbDefined.InsertEntry( ScGlobal::GetRscString( STR_HF_NONE_IN_BRACKETS )); + + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aPageEntry += aPageFieldValue; + maLbDefined.InsertEntry(aPageEntry); + + String aPageOfEntry(aPageEntry); + aPageOfEntry += ' '; + aPageOfEntry += ScGlobal::GetRscString( STR_HF_OF_QUESTION ); + maLbDefined.InsertEntry( aPageOfEntry); + + maLbDefined.InsertEntry(aSheetFieldValue); + + String aConfidentialEntry(aUserOpt.GetCompany()); + aConfidentialEntry += ' '; + aConfidentialEntry += ScGlobal::GetRscString( STR_HF_CONFIDENTIAL ); + aConfidentialEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aConfidentialEntry += aDateFieldValue; + aConfidentialEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aConfidentialEntry += aPageEntry; + maLbDefined.InsertEntry( aConfidentialEntry); + + String aFileNamePageEntry(aFileFieldValue); + aFileNamePageEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aFileNamePageEntry += aPageEntry; + maLbDefined.InsertEntry( aFileNamePageEntry); + + maLbDefined.InsertEntry( aExtFileFieldValue); + + String aPageSheetNameEntry(aPageEntry); + aPageSheetNameEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aPageSheetNameEntry += aSheetFieldValue; + maLbDefined.InsertEntry( aPageSheetNameEntry); + + String aPageFileNameEntry(aPageEntry); + aPageFileNameEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aPageFileNameEntry += aFileFieldValue; + maLbDefined.InsertEntry( aPageFileNameEntry); + + String aPagePathNameEntry(aPageEntry); + aPagePathNameEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aPagePathNameEntry += aExtFileFieldValue; + maLbDefined.InsertEntry( aPagePathNameEntry); + + String aUserNameEntry(aUserOpt.GetFirstName()); + aUserNameEntry += ' '; + aUserNameEntry += (String)aUserOpt.GetLastName(); + aUserNameEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aUserNameEntry += aPageEntry; + aUserNameEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aUserNameEntry += aDateFieldValue; + maLbDefined.InsertEntry( aUserNameEntry); + + String aCreatedByEntry(ScGlobal::GetRscString( STR_HF_CREATED_BY ) ); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetFirstName(); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetLastName(); + aCreatedByEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aCreatedByEntry += aDateFieldValue; + aCreatedByEntry.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); + aCreatedByEntry += aPageEntry; + maLbDefined.InsertEntry( aCreatedByEntry); +} + +void ScHFEditPage::InsertToDefinedList() +{ + USHORT nCount = maLbDefined.GetEntryCount(); + if(nCount == eEntryCount) + { + String aCustomizedEntry(ScGlobal::GetRscString( STR_HF_CUSTOMIZED ) ); + maLbDefined.InsertEntry( aCustomizedEntry); + maLbDefined.SelectEntryPos(eEntryCount); + } +} + +void ScHFEditPage::RemoveFromDefinedList() +{ + USHORT nCount = maLbDefined.GetEntryCount(); + if(nCount > eEntryCount ) + maLbDefined.RemoveEntry( nCount-1); +} + +// determine if the header/footer exists in our predefined list and set select to it. +void ScHFEditPage::SetSelectDefinedList() +{ + SvtUserOptions aUserOpt; + + // default to customized + ScHFEntryId eSelectEntry = eEntryCount; + + ::std::auto_ptr< EditTextObject > pLeftObj; + ::std::auto_ptr< EditTextObject > pCenterObj; + ::std::auto_ptr< EditTextObject > pRightObj; + + XubString aLeftEntry; + XubString aCenterEntry; + XubString aRightEntry; + + pLeftObj.reset(aWndLeft.GetEditEngine()->CreateTextObject()); + pCenterObj.reset(aWndCenter.GetEditEngine()->CreateTextObject()); + pRightObj.reset(aWndRight.GetEditEngine()->CreateTextObject()); + + bool bFound = false; + + USHORT i; + USHORT nCount = maLbDefined.GetEntryCount(); + for(i = 0; i < nCount && !bFound; i++) + { + switch(static_cast<ScHFEntryId>(i)) + { + case eNoneEntry: + { + aLeftEntry = pLeftObj->GetText(0); + aCenterEntry = pCenterObj->GetText(0); + aRightEntry = pRightObj->GetText(0); + if(aLeftEntry == EMPTY_STRING && aCenterEntry == EMPTY_STRING + && aRightEntry == EMPTY_STRING) + { + eSelectEntry = eNoneEntry; + bFound = true; + } + } + break; + + case ePageEntry: + { + aLeftEntry = pLeftObj->GetText(0); + aRightEntry = pRightObj->GetText(0); + if(aLeftEntry == EMPTY_STRING && aRightEntry == EMPTY_STRING) + { + if(IsPageEntry(aWndCenter.GetEditEngine(), pCenterObj.get())) + { + eSelectEntry = ePageEntry; + bFound = true; + } + } + } + break; + + + //TODO + case ePagesEntry: + { + } + break; + + case eSheetEntry: + { + aLeftEntry = pLeftObj->GetText(0); + aRightEntry = pRightObj->GetText(0); + if(aLeftEntry == EMPTY_STRING && aRightEntry == EMPTY_STRING) + { + if(pCenterObj->IsFieldObject()) + { + const SvxFieldItem* pFieldItem = pCenterObj->GetField(); + if(pFieldItem) + { + const SvxFieldData* pField = pFieldItem->GetField(); + if(pField && pField->ISA(SvxTableField)) + { + eSelectEntry = eSheetEntry; + bFound = true; + } + } + } + } + } + break; + + case eConfidentialEntry: + { + if(IsDateEntry(pCenterObj.get()) && IsPageEntry(aWndRight.GetEditEngine(), pRightObj.get())) + { + String aConfidentialEntry(aUserOpt.GetCompany()); + aConfidentialEntry += ' '; + aConfidentialEntry += ScGlobal::GetRscString( STR_HF_CONFIDENTIAL ); + if(aConfidentialEntry == aWndLeft.GetEditEngine()->GetText(0)) + { + eSelectEntry = eConfidentialEntry; + bFound = true; + } + } + } + break; + + //TODO + case eFileNamePageEntry: + { + } + break; + + case eExtFileNameEntry: + { + aLeftEntry = pLeftObj->GetText(0); + aRightEntry = pRightObj->GetText(0); + if(IsExtFileNameEntry(pCenterObj.get()) && aLeftEntry == EMPTY_STRING + && aRightEntry == EMPTY_STRING) + { + eSelectEntry = eExtFileNameEntry; + bFound = true; + } + } + break; + + //TODO + case ePageSheetEntry: + { + } + break; + + //TODO + case ePageFileNameEntry: + { + } + break; + + case ePageExtFileNameEntry: + { + aLeftEntry = pLeftObj->GetText(0); + if(IsPageEntry(aWndCenter.GetEditEngine(), pCenterObj.get()) && + IsExtFileNameEntry(pRightObj.get()) && aLeftEntry == EMPTY_STRING) + { + eSelectEntry = ePageExtFileNameEntry; + bFound = true; + } + } + break; + + case eUserNameEntry: + { + if(IsDateEntry(pRightObj.get()) && IsPageEntry(aWndCenter.GetEditEngine(), pCenterObj.get())) + { + String aUserNameEntry(aUserOpt.GetFirstName()); + aUserNameEntry += ' '; + aUserNameEntry += (String)aUserOpt.GetLastName(); + if(aUserNameEntry == aWndLeft.GetEditEngine()->GetText(0)) + { + eSelectEntry = eUserNameEntry; + bFound = true; + } + } + } + break; + + case eCreatedByEntry: + { + if(IsDateEntry(pCenterObj.get()) && IsPageEntry(aWndRight.GetEditEngine(), pRightObj.get())) + { + String aCreatedByEntry(ScGlobal::GetRscString( STR_HF_CREATED_BY ) ); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetFirstName(); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetLastName(); + if(aCreatedByEntry == aWndLeft.GetEditEngine()->GetText(0)) + { + eSelectEntry = eCreatedByEntry; + bFound = true; + } + } + } + break; + + default: + { + // added to avoid warnings + } + } + } + + if(eSelectEntry == eEntryCount) + InsertToDefinedList(); + + maLbDefined.SelectEntryPos( sal::static_int_cast<USHORT>( eSelectEntry ) ); +} + +bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, EditTextObject* pTextObj) +{ + if(!pEngine && !pTextObj) + return false; + + bool bReturn = false; + + if(!pTextObj->IsFieldObject()) + { + SvUShorts aPosList; + pEngine->GetPortions(0,aPosList); + if(aPosList.Count() == 2) + { + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + ESelection aSel(0,0,0,0); + aSel.nEndPos = aPageEntry.Len(); + if(aPageEntry == pEngine->GetText(aSel)) + { + aSel.nStartPos = aSel.nEndPos; + aSel.nEndPos++; + ::std::auto_ptr< EditTextObject > pPageObj; + pPageObj.reset(pEngine->CreateTextObject(aSel)); + if(pPageObj.get() && pPageObj->IsFieldObject() ) + { + const SvxFieldItem* pFieldItem = pPageObj->GetField(); + if(pFieldItem) + { + const SvxFieldData* pField = pFieldItem->GetField(); + if(pField && pField->ISA(SvxPageField)) + bReturn = true; + } + } + } + } + } + return bReturn; +} + +bool ScHFEditPage::IsDateEntry(EditTextObject* pTextObj) +{ + if(!pTextObj) + return false; + + bool bReturn = false; + if(pTextObj->IsFieldObject()) + { + const SvxFieldItem* pFieldItem = pTextObj->GetField(); + if(pFieldItem) + { + const SvxFieldData* pField = pFieldItem->GetField(); + if(pField && pField->ISA(SvxDateField)) + bReturn = true; + } + } + return bReturn; +} + +bool ScHFEditPage::IsExtFileNameEntry(EditTextObject* pTextObj) +{ + if(!pTextObj) + return false; + bool bReturn = false; + if(pTextObj->IsFieldObject()) + { + const SvxFieldItem* pFieldItem = pTextObj->GetField(); + if(pFieldItem) + { + const SvxFieldData* pField = pFieldItem->GetField(); + if(pField && pField->ISA(SvxExtFileField)) + bReturn = true; + } + } + return bReturn; +} + +void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) +{ + SvtUserOptions aUserOpt; + ::std::auto_ptr< EditTextObject > pTextObj; + + switch(eSel) + { + case eNoneEntry: + ClearTextAreas(); + if(!bTravelling) + aWndLeft.GrabFocus(); + break; + + case ePageEntry: + { + ClearTextAreas(); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aWndCenter.InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + if(!bTravelling) + aWndCenter.GrabFocus(); + } + break; + + case ePagesEntry: + { + ClearTextAreas(); + ESelection aSel(0,0,0,0); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aSel.nEndPos = aPageEntry.Len(); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + ++aSel.nEndPos; + String aPageOfEntry = ' '; + aPageOfEntry += ScGlobal::GetRscString( STR_HF_OF ); + aPageOfEntry += ' '; + aWndCenter.GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aPageOfEntry.Len() ); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + pTextObj.reset(aWndCenter.GetEditEngine()->CreateTextObject()); + aWndCenter.SetText(*pTextObj); + XubString aEntry(pTextObj.get()->GetText(0)); + if(!bTravelling) + aWndCenter.GrabFocus(); + } + break; + + case eSheetEntry: + ClearTextAreas(); + aWndCenter.InsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD) ); + if(!bTravelling) + aWndCenter.GrabFocus(); + break; + + case eConfidentialEntry: + { + ClearTextAreas(); + String aConfidentialEntry(aUserOpt.GetCompany()); + aConfidentialEntry += ' '; + aConfidentialEntry += ScGlobal::GetRscString( STR_HF_CONFIDENTIAL ); + aWndLeft.GetEditEngine()->SetText(aConfidentialEntry); + aWndCenter.InsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR), EE_FEATURE_FIELD) ); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndRight.GetEditEngine()->SetText(aPageEntry); + aWndRight.InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + if(!bTravelling) + aWndRight.GrabFocus(); + } + break; + + case eFileNamePageEntry: + { + ClearTextAreas(); + ESelection aSel(0,0,0,0); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ), aSel ); + ++aSel.nEndPos; + String aPageEntry(RTL_CONSTASCII_STRINGPARAM(", ")); + aPageEntry += ScGlobal::GetRscString( STR_PAGE ) ; + aPageEntry += ' '; + aWndCenter.GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + aSel.nStartPos = aSel.nEndPos; + aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aPageEntry.Len() ); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + pTextObj.reset(aWndCenter.GetEditEngine()->CreateTextObject()); + aWndCenter.SetText(*pTextObj); + XubString aEntry2(pTextObj.get()->GetText(0)); + if(!bTravelling) + aWndCenter.GrabFocus(); + } + break; + + case eExtFileNameEntry: + ClearTextAreas(); + aWndCenter.InsertField( SvxFieldItem( SvxExtFileField( + EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_FULLPATH ), EE_FEATURE_FIELD ) ); + if(!bTravelling) + aWndCenter.GrabFocus(); + break; + + case ePageSheetEntry: + { + ClearTextAreas(); + ESelection aSel(0,0,0,0); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aSel.nEndPos = aPageEntry.Len(); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + ++aSel.nEndPos; + String aCommaSpace(RTL_CONSTASCII_STRINGPARAM(", ")); + aWndCenter.GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aCommaSpace.Len() ); + aWndCenter.GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + pTextObj.reset(aWndCenter.GetEditEngine()->CreateTextObject()); + aWndCenter.SetText(*pTextObj); + if(!bTravelling) + aWndCenter.GrabFocus(); + } + break; + + case ePageFileNameEntry: + { + ClearTextAreas(); + ESelection aSel(0,0,0,0); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aSel.nEndPos = aPageEntry.Len(); + aWndCenter.GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + ++aSel.nEndPos; + String aCommaSpace(RTL_CONSTASCII_STRINGPARAM(", ")); + aWndCenter.GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aCommaSpace.Len() ); + aWndCenter.GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); + pTextObj.reset(aWndCenter.GetEditEngine()->CreateTextObject()); + aWndCenter.SetText(*pTextObj); + if(!bTravelling) + aWndCenter.GrabFocus(); + } + break; + + case ePageExtFileNameEntry: + { + ClearTextAreas(); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aWndCenter.InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + aWndRight.InsertField( SvxFieldItem( SvxExtFileField( + EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_FULLPATH ), EE_FEATURE_FIELD ) ); + if(!bTravelling) + aWndRight.GrabFocus(); + } + break; + + case eUserNameEntry: + { + ClearTextAreas(); + String aUserNameEntry(aUserOpt.GetFirstName()); + aUserNameEntry += ' '; + aUserNameEntry += (String)aUserOpt.GetLastName(); + aWndLeft.GetEditEngine()->SetText(aUserNameEntry); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndCenter.GetEditEngine()->SetText(aPageEntry); + aWndCenter.InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + aWndRight.InsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR), EE_FEATURE_FIELD) ); + if(!bTravelling) + aWndRight.GrabFocus(); + } + break; + + case eCreatedByEntry: + { + ClearTextAreas(); + String aCreatedByEntry(ScGlobal::GetRscString( STR_HF_CREATED_BY ) ); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetFirstName(); + aCreatedByEntry += ' '; + aCreatedByEntry += (String)aUserOpt.GetLastName(); + aWndLeft.GetEditEngine()->SetText(aCreatedByEntry); + aWndCenter.InsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR), EE_FEATURE_FIELD) ); + String aPageEntry(ScGlobal::GetRscString( STR_PAGE ) ); + aPageEntry += ' '; + aWndRight.GetEditEngine()->SetText(aPageEntry); + aWndRight.InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + if(!bTravelling) + aWndRight.GrabFocus(); + } + break; + + default : + break; + } +} + +void ScHFEditPage::ClearTextAreas() +{ + aWndLeft.GetEditEngine()->SetText(EMPTY_STRING); + aWndLeft.Invalidate(); + aWndCenter.GetEditEngine()->SetText(EMPTY_STRING); + aWndCenter.Invalidate(); + aWndRight.GetEditEngine()->SetText(EMPTY_STRING); + aWndRight.Invalidate(); +} + +//----------------------------------------------------------------------- +// Handler: +//----------------------------------------------------------------------- + +IMPL_LINK( ScHFEditPage, ListHdl_Impl, ListBox*, pList ) +{ + if ( pList && pList == &maLbDefined ) + { + ScHFEntryId eSel = static_cast<ScHFEntryId>(maLbDefined.GetSelectEntryPos()); + if(!maLbDefined.IsTravelSelect()) + { + ProcessDefinedListSel(eSel); + + // check if we need to remove the customized entry. + if(eSel < eEntryCount) + RemoveFromDefinedList(); + } + else + { + ProcessDefinedListSel(eSel, true); + } + } + return 0; +} + +IMPL_LINK( ScHFEditPage, ClickHdl, ImageButton*, pBtn ) +{ + pActiveEdWnd = ::GetScEditWindow(); //CHINA001 + if ( !pActiveEdWnd ) + return 0; + + if ( pBtn == &aBtnText ) + { + pActiveEdWnd->SetCharAttriutes(); + } + else + { + if ( pBtn == &aBtnPage ) + pActiveEdWnd->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) ); + else if ( pBtn == &aBtnLastPage ) + pActiveEdWnd->InsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD) ); + else if ( pBtn == &aBtnDate ) + pActiveEdWnd->InsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR), EE_FEATURE_FIELD) ); + else if ( pBtn == &aBtnTime ) + pActiveEdWnd->InsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD) ); + else if ( pBtn == &aBtnFile ) + { + pActiveEdWnd->InsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ) ); + } + else if ( pBtn == &aBtnTable ) + pActiveEdWnd->InsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD) ); + } + InsertToDefinedList(); + pActiveEdWnd->GrabFocus(); + + return 0; +} + +IMPL_LINK( ScHFEditPage, MenuHdl, ScExtIButton*, pBtn ) +{ + pActiveEdWnd = ::GetScEditWindow(); //CHINA001 + if ( !pActiveEdWnd ) + return 0; + + if(pBtn!=NULL) + { + switch(pBtn->GetSelected()) + { + case FILE_COMMAND_TITEL: + pActiveEdWnd->InsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ) ); + break; + case FILE_COMMAND_FILENAME: + pActiveEdWnd->InsertField( SvxFieldItem( SvxExtFileField( + EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT ), EE_FEATURE_FIELD ) ); + break; + case FILE_COMMAND_PATH: + pActiveEdWnd->InsertField( SvxFieldItem( SvxExtFileField( + EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_FULLPATH ), EE_FEATURE_FIELD ) ); + break; + } + } + return 0; +} + +//======================================================================== +// class ScRightHeaderEditPage +//======================================================================== + +ScRightHeaderEditPage::ScRightHeaderEditPage( Window* pParent, const SfxItemSet& rCoreSet ) + : ScHFEditPage( pParent, RID_SCPAGE_HFED_HR, rCoreSet, + rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERRIGHT ), true ) + {} + +// ----------------------------------------------------------------------- + +USHORT* __EXPORT ScRightHeaderEditPage::GetRanges() + { return pPageRightHeaderRanges; } + +// ----------------------------------------------------------------------- + +SfxTabPage* __EXPORT ScRightHeaderEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) + { return ( new ScRightHeaderEditPage( pParent, rCoreSet ) ); }; + + +//======================================================================== +// class ScLeftHeaderEditPage +//======================================================================== + +ScLeftHeaderEditPage::ScLeftHeaderEditPage( Window* pParent, const SfxItemSet& rCoreSet ) + : ScHFEditPage( pParent, RID_SCPAGE_HFED_HL, rCoreSet, + rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERLEFT ), true ) + {} + +// ----------------------------------------------------------------------- + +USHORT* __EXPORT ScLeftHeaderEditPage::GetRanges() + { return pPageLeftHeaderRanges; } + +// ----------------------------------------------------------------------- + +SfxTabPage* __EXPORT ScLeftHeaderEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) + { return ( new ScLeftHeaderEditPage( pParent, rCoreSet ) ); }; + +//======================================================================== +// class ScRightFooterEditPage +//======================================================================== + +ScRightFooterEditPage::ScRightFooterEditPage( Window* pParent, const SfxItemSet& rCoreSet ) + : ScHFEditPage( pParent, RID_SCPAGE_HFED_FR, rCoreSet, + rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERRIGHT ), false ) + {} + +// ----------------------------------------------------------------------- + +USHORT* __EXPORT ScRightFooterEditPage::GetRanges() + { return pPageRightFooterRanges; } + +// ----------------------------------------------------------------------- + +SfxTabPage* __EXPORT ScRightFooterEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) + { return ( new ScRightFooterEditPage( pParent, rCoreSet ) ); }; + +//======================================================================== +// class ScLeftFooterEditPage +//======================================================================== + +ScLeftFooterEditPage::ScLeftFooterEditPage( Window* pParent, const SfxItemSet& rCoreSet ) + : ScHFEditPage( pParent, RID_SCPAGE_HFED_FL, rCoreSet, + rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERLEFT ), false ) + {} + +// ----------------------------------------------------------------------- + +USHORT* __EXPORT ScLeftFooterEditPage::GetRanges() + { return pPageLeftFooterRanges; } + +// ----------------------------------------------------------------------- + +SfxTabPage* __EXPORT ScLeftFooterEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) + { return ( new ScLeftFooterEditPage( pParent, rCoreSet ) ); }; diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx new file mode 100644 index 000000000000..de647cf5f82a --- /dev/null +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -0,0 +1,331 @@ +/************************************************************************* + * + * 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_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + + + +//------------------------------------------------------------------ + +#define _TPHF_CXX +#include "scitems.hxx" +#include <sfx2/basedlgs.hxx> +#include <svl/style.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> + +#include "tphf.hxx" +#include "sc.hrc" +#include "globstr.hrc" +#include "tabvwsh.hxx" +#include "viewdata.hxx" +#include "document.hxx" +//CHINA001 #include "tphfedit.hxx" +#include "hfedtdlg.hxx" +#include "styledlg.hxx" +#include "scresid.hxx" +#include "scuitphfedit.hxx" //CHINA001 +#undef _TPHF_CXX + + + +//================================================================== +// class ScHFPage +//================================================================== + +ScHFPage::ScHFPage( Window* pParent, USHORT nResId, + const SfxItemSet& rSet, USHORT nSetId ) + + : SvxHFPage ( pParent, nResId, rSet, nSetId ), + aBtnEdit ( this, ScResId( RID_SCBTN_HFEDIT ) ), + aDataSet ( *rSet.GetPool(), + ATTR_PAGE_HEADERLEFT, ATTR_PAGE_FOOTERRIGHT, + ATTR_PAGE, ATTR_PAGE, 0 ), + nPageUsage ( (USHORT)SVX_PAGE_ALL ), + pStyleDlg ( NULL ) +{ + SetExchangeSupport(); + + SfxViewShell* pSh = SfxViewShell::Current(); + ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,pSh); + Point aPos( aBackgroundBtn.GetPosPixel() ); + + // aBackgroundBtn position not changed anymore + + aPos.X() += aBackgroundBtn.GetSizePixel().Width(); + aPos.X() += LogicToPixel( Size(3,0), MAP_APPFONT ).Width(); + aBtnEdit.SetPosPixel( aPos ); + aBtnEdit.Show(); + + aDataSet.Put( rSet ); + + if ( pViewSh ) + { + ScViewData* pViewData = pViewSh->GetViewData(); + ScDocument* pDoc = pViewData->GetDocument(); + + aStrPageStyle = pDoc->GetPageStyle( pViewData->GetTabNo() ); + } + + aBtnEdit.SetClickHdl ( LINK( this, ScHFPage, BtnHdl ) ); + aTurnOnBox.SetClickHdl ( LINK( this, ScHFPage, TurnOnHdl ) ); + + if ( nId == SID_ATTR_PAGE_HEADERSET ) + aBtnEdit.SetHelpId( HID_SC_HEADER_EDIT ); + else + aBtnEdit.SetHelpId( HID_SC_FOOTER_EDIT ); +} + +//------------------------------------------------------------------ + +__EXPORT ScHFPage::~ScHFPage() +{ +} + +//------------------------------------------------------------------ + +void __EXPORT ScHFPage::Reset( const SfxItemSet& rSet ) +{ + SvxHFPage::Reset( rSet ); + TurnOnHdl( 0 ); +} + +//------------------------------------------------------------------ + +BOOL __EXPORT ScHFPage::FillItemSet( SfxItemSet& rOutSet ) +{ + BOOL bResult = SvxHFPage::FillItemSet( rOutSet ); + + if ( nId == SID_ATTR_PAGE_HEADERSET ) + { + rOutSet.Put( aDataSet.Get( ATTR_PAGE_HEADERLEFT ) ); + rOutSet.Put( aDataSet.Get( ATTR_PAGE_HEADERRIGHT ) ); + } + else + { + rOutSet.Put( aDataSet.Get( ATTR_PAGE_FOOTERLEFT ) ); + rOutSet.Put( aDataSet.Get( ATTR_PAGE_FOOTERRIGHT ) ); + } + + return bResult; +} + +//------------------------------------------------------------------ + +void __EXPORT ScHFPage::ActivatePage( const SfxItemSet& rSet ) +{ + USHORT nPageWhich = GetWhich( SID_ATTR_PAGE ); + const SvxPageItem& rPageItem = (const SvxPageItem&) + rSet.Get(nPageWhich); + + nPageUsage = rPageItem.GetPageUsage(); + + if ( pStyleDlg ) + aStrPageStyle = pStyleDlg->GetStyleSheet().GetName(); + + aDataSet.Put( rSet.Get(ATTR_PAGE) ); + + SvxHFPage::ActivatePage( rSet ); +} + +//------------------------------------------------------------------ + +int __EXPORT ScHFPage::DeactivatePage( SfxItemSet* pSetP ) +{ + if ( LEAVE_PAGE == SvxHFPage::DeactivatePage( pSetP ) ) + if ( pSetP ) + FillItemSet( *pSetP ); + + return LEAVE_PAGE; +} + +//------------------------------------------------------------------ + +void ScHFPage::ActivatePage() +{ +} + +void ScHFPage::DeactivatePage() +{ +} + +//------------------------------------------------------------------ +// Handler: +//------------------------------------------------------------------ + +IMPL_LINK( ScHFPage, TurnOnHdl, CheckBox*, EMPTYARG ) +{ + SvxHFPage::TurnOnHdl( &aTurnOnBox ); + + if ( aTurnOnBox.IsChecked() ) + aBtnEdit.Enable(); + else + aBtnEdit.Disable(); + + return 0; +} + + +//------------------------------------------------------------------ + +IMPL_LINK( ScHFPage, BtnHdl, PushButton*, EMPTYARG ) +{ + // Wenn der Bearbeiten-Dialog direkt aus dem Click-Handler des Buttons + // aufgerufen wird, funktioniert im Bearbeiten-Dialog unter OS/2 das + // GrabFocus nicht (Bug #41805#). + // Mit dem neuen StarView sollte dieser Workaround wieder raus koennen! + + Application::PostUserEvent( LINK( this, ScHFPage, HFEditHdl ) ); + return 0; +} + +IMPL_LINK( ScHFPage, HFEditHdl, void*, EMPTYARG ) +{ + SfxViewShell* pViewSh = SfxViewShell::Current(); + + if ( !pViewSh ) + { + DBG_ERROR( "Current ViewShell not found." ); + return 0; + } + + if ( aCntSharedBox.IsEnabled() + && !aCntSharedBox.IsChecked() ) + { + USHORT nResId = ( nId == SID_ATTR_PAGE_HEADERSET ) + ? RID_SCDLG_HFED_HEADER + : RID_SCDLG_HFED_FOOTER; + + ScHFEditDlg* pDlg + = new ScHFEditDlg( pViewSh->GetViewFrame(), this, + aDataSet, aStrPageStyle, nResId ); + + if ( pDlg->Execute() == RET_OK ) + { + aDataSet.Put( *pDlg->GetOutputItemSet() ); + } + + delete pDlg; + } + else + { + String aText; + SfxSingleTabDialog* pDlg = new SfxSingleTabDialog( this, aDataSet, 42 ); + BOOL bRightPage = aCntSharedBox.IsChecked() + || ( SVX_PAGE_LEFT != SvxPageUsage(nPageUsage) ); + + if ( nId == SID_ATTR_PAGE_HEADERSET ) + { + aText = ScGlobal::GetRscString( STR_PAGEHEADER ); + if ( bRightPage ) + pDlg->SetTabPage( ScRightHeaderEditPage::Create( pDlg, aDataSet ) ); + else + pDlg->SetTabPage( ScLeftHeaderEditPage::Create( pDlg, aDataSet ) ); + } + else + { + aText = ScGlobal::GetRscString( STR_PAGEFOOTER ); + if ( bRightPage ) + pDlg->SetTabPage( ScRightFooterEditPage::Create( pDlg, aDataSet ) ); + else + pDlg->SetTabPage( ScLeftFooterEditPage::Create( pDlg, aDataSet ) ); + } + + SvxNumType eNumType = ((const SvxPageItem&)aDataSet.Get(ATTR_PAGE)).GetNumType(); + ((ScHFEditPage*)pDlg->GetTabPage())->SetNumType(eNumType); + + aText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " (" )); + aText += ScGlobal::GetRscString( STR_PAGESTYLE ); + aText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ": " )); + aText += aStrPageStyle; + aText += ')'; + + pDlg->SetText( aText ); + + if ( pDlg->Execute() == RET_OK ) + { + aDataSet.Put( *pDlg->GetOutputItemSet() ); + } + + delete pDlg; + } + + return 0; +} + +//================================================================== +// class ScHeaderPage +//================================================================== + +ScHeaderPage::ScHeaderPage( Window* pParent, const SfxItemSet& rSet ) + : ScHFPage( pParent, RID_SVXPAGE_HEADER, rSet, SID_ATTR_PAGE_HEADERSET ) +{ +} + +//------------------------------------------------------------------ + +SfxTabPage* __EXPORT ScHeaderPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +{ + return ( new ScHeaderPage( pParent, rCoreSet ) ); +} + +//------------------------------------------------------------------ + +USHORT* __EXPORT ScHeaderPage::GetRanges() +{ + return SvxHeaderPage::GetRanges(); +} + +//================================================================== +// class ScFooterPage +//================================================================== + +ScFooterPage::ScFooterPage( Window* pParent, const SfxItemSet& rSet ) + : ScHFPage( pParent, RID_SVXPAGE_FOOTER, rSet, SID_ATTR_PAGE_FOOTERSET ) +{ +} + +//------------------------------------------------------------------ + +SfxTabPage* __EXPORT ScFooterPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +{ + return ( new ScFooterPage( pParent, rCoreSet ) ); +} + +//------------------------------------------------------------------ + +USHORT* __EXPORT ScFooterPage::GetRanges() +{ + return SvxHeaderPage::GetRanges(); +} + + + + diff --git a/sc/source/ui/pagedlg/tphf.src b/sc/source/ui/pagedlg/tphf.src new file mode 100644 index 000000000000..b2f59e06da72 --- /dev/null +++ b/sc/source/ui/pagedlg/tphf.src @@ -0,0 +1,64 @@ +/************************************************************************* + * + * 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 "sc.hrc" +PushButton RID_SCBTN_HFEDIT +{ + TabStop = TRUE ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Edit..." ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx new file mode 100644 index 000000000000..8e6b6efda28d --- /dev/null +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -0,0 +1,874 @@ +/************************************************************************* + * + * 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_sc.hxx" + + + +//------------------------------------------------------------------ + +#define _TPHFEDIT_CXX +#include "scitems.hxx" +#include <editeng/eeitem.hxx> + + +//CHINA001 #include <svx/chardlg.hxx> +#include <editeng/editobj.hxx> +#include <editeng/editstat.hxx> +#include <editeng/editview.hxx> +#include <editeng/flditem.hxx> +#include <editeng/adjitem.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/objsh.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> + +#include "tphfedit.hxx" +#include "editutil.hxx" +#include "global.hxx" +#include "attrib.hxx" +#include "patattr.hxx" +#include "scresid.hxx" +#include "sc.hrc" +#include "globstr.hrc" +#include "tabvwsh.hxx" +#include "prevwsh.hxx" +#include "hfedtdlg.hrc" +//CHINA001 #include "textdlgs.hxx" +#include "AccessibleEditObject.hxx" + +#include "scabstdlg.hxx" //CHINA001 + + +// STATIC DATA ----------------------------------------------------------- +static ScEditWindow* pActiveEdWnd = NULL; + +ScEditWindow* GetScEditWindow () +{ + return pActiveEdWnd; +} + +//CHINA001 +//CHINA001 static USHORT pPageRightHeaderRanges[] = { SID_SCATTR_PAGE_HEADERRIGHT, +//CHINA001 SID_SCATTR_PAGE_HEADERRIGHT, +//CHINA001 0 }; +//CHINA001 +//CHINA001 static USHORT pPageRightFooterRanges[] = { SID_SCATTR_PAGE_FOOTERRIGHT, +//CHINA001 SID_SCATTR_PAGE_FOOTERRIGHT, +//CHINA001 0 }; +//CHINA001 +//CHINA001 static USHORT pPageLeftHeaderRanges[] = { SID_SCATTR_PAGE_HEADERLEFT, +//CHINA001 SID_SCATTR_PAGE_HEADERLEFT, +//CHINA001 0 }; +//CHINA001 +//CHINA001 static USHORT pPageLeftFooterRanges[] = { SID_SCATTR_PAGE_FOOTERLEFT, +//CHINA001 SID_SCATTR_PAGE_FOOTERLEFT, +//CHINA001 0 }; +//CHINA001 +//CHINA001 static ScEditWindow* pActiveEdWnd = NULL; +//CHINA001 +//CHINA001 +//CHINA001 +//CHINA001 //======================================================================== +//CHINA001 // class ScHFEditPage +//CHINA001 // +//CHINA001 +//CHINA001 ScHFEditPage::ScHFEditPage( Window* pParent, +//CHINA001 USHORT nResId, +//CHINA001 const SfxItemSet& rCoreAttrs, +//CHINA001 USHORT nWhichId ) +//CHINA001 +//CHINA001 : SfxTabPage ( pParent, ScResId( nResId ), rCoreAttrs ), +//CHINA001 +//CHINA001 aWndLeft ( this, ScResId( WND_LEFT ), Left ), +//CHINA001 aWndCenter ( this, ScResId( WND_CENTER ), Center ), +//CHINA001 aWndRight ( this, ScResId( WND_RIGHT ), Right ), +//CHINA001 aFtLeft ( this, ScResId( FT_LEFT ) ), +//CHINA001 aFtCenter ( this, ScResId( FT_CENTER ) ), +//CHINA001 aFtRight ( this, ScResId( FT_RIGHT ) ), +//CHINA001 aFlInfo ( this, ScResId( FL_INFO ) ), +//CHINA001 aFtInfo ( this, ScResId( FT_INFO ) ), +//CHINA001 aBtnText ( this, ScResId( BTN_TEXT ) ), +//CHINA001 aBtnPage ( this, ScResId( BTN_PAGE ) ), +//CHINA001 aBtnLastPage ( this, ScResId( BTN_PAGES ) ), +//CHINA001 aBtnDate ( this, ScResId( BTN_DATE ) ), +//CHINA001 aBtnTime ( this, ScResId( BTN_TIME ) ), +//CHINA001 aBtnFile ( this, ScResId( BTN_FILE ) ), +//CHINA001 aBtnTable ( this, ScResId( BTN_TABLE ) ), +//CHINA001 aPopUpFile ( ScResId( RID_POPUP_FCOMMAND) ), +//CHINA001 nWhich ( nWhichId ) +//CHINA001 { +//CHINA001 //! use default style from current document? +//CHINA001 //! if font color is used, header/footer background color must be set +//CHINA001 +//CHINA001 ScPatternAttr aPatAttr( rCoreAttrs.GetPool() ); +//CHINA001 +//CHINA001 aBtnFile.SetPopupMenu(&aPopUpFile); +//CHINA001 +//CHINA001 aBtnFile.SetMenuHdl( LINK( this, ScHFEditPage, MenuHdl ) ); +//CHINA001 aBtnText .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnPage .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnLastPage.SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnDate .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnTime .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnFile .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 aBtnTable .SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) ); +//CHINA001 +//CHINA001 aBtnText .SetModeImage( Image( ScResId( IMG_TEXT_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnFile .SetModeImage( Image( ScResId( IMG_FILE_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnTable .SetModeImage( Image( ScResId( IMG_TABLE_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnPage .SetModeImage( Image( ScResId( IMG_PAGE_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnLastPage.SetModeImage( Image( ScResId( IMG_PAGES_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnDate .SetModeImage( Image( ScResId( IMG_DATE_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 aBtnTime .SetModeImage( Image( ScResId( IMG_TIME_H ) ), BMP_COLOR_HIGHCONTRAST ); +//CHINA001 +//CHINA001 aWndLeft. SetFont( aPatAttr ); +//CHINA001 aWndCenter. SetFont( aPatAttr ); +//CHINA001 aWndRight. SetFont( aPatAttr ); +//CHINA001 +//CHINA001 FillCmdArr(); +//CHINA001 +//CHINA001 aWndLeft.GrabFocus(); +//CHINA001 +//CHINA001 FreeResource(); +//CHINA001 } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 __EXPORT ScHFEditPage::~ScHFEditPage() +//CHINA001 { +//CHINA001 } +//CHINA001 +//CHINA001 void ScHFEditPage::SetNumType(SvxNumType eNumType) +//CHINA001 { +//CHINA001 aWndLeft.SetNumType(eNumType); +//CHINA001 aWndCenter.SetNumType(eNumType); +//CHINA001 aWndRight.SetNumType(eNumType); +//CHINA001 } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 #define IS_AVAILABLE(w)(rCoreSet.GetItemState( (w) ) >= SFX_ITEM_AVAILABLE) +//CHINA001 +//CHINA001 void __EXPORT ScHFEditPage::Reset( const SfxItemSet& rCoreSet ) +//CHINA001 { +//CHINA001 if ( IS_AVAILABLE( nWhich ) ) +//CHINA001 { +//CHINA001 const ScPageHFItem& rItem = (const ScPageHFItem&)(rCoreSet.Get( nWhich )); +//CHINA001 +//CHINA001 const EditTextObject* pLeft = rItem.GetLeftArea(); +//CHINA001 const EditTextObject* pCenter = rItem.GetCenterArea(); +//CHINA001 const EditTextObject* pRight = rItem.GetRightArea(); +//CHINA001 +//CHINA001 if ( pLeft && pCenter && pRight ) +//CHINA001 { +//CHINA001 aWndLeft .SetText( *pLeft ); +//CHINA001 aWndCenter .SetText( *pCenter ); +//CHINA001 aWndRight .SetText( *pRight ); +//CHINA001 } +//CHINA001 } +//CHINA001 } +//CHINA001 +//CHINA001 #undef IS_AVAILABLE +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 BOOL __EXPORT ScHFEditPage::FillItemSet( SfxItemSet& rCoreSet ) +//CHINA001 { +//CHINA001 ScPageHFItem aItem( nWhich ); +//CHINA001 EditTextObject* pLeft = aWndLeft .CreateTextObject(); +//CHINA001 EditTextObject* pCenter = aWndCenter.CreateTextObject(); +//CHINA001 EditTextObject* pRight = aWndRight .CreateTextObject(); +//CHINA001 +//CHINA001 aItem.SetLeftArea ( *pLeft ); +//CHINA001 aItem.SetCenterArea( *pCenter ); +//CHINA001 aItem.SetRightArea ( *pRight ); +//CHINA001 delete pLeft; +//CHINA001 delete pCenter; +//CHINA001 delete pRight; +//CHINA001 +//CHINA001 rCoreSet.Put( aItem ); +//CHINA001 +//CHINA001 return TRUE; +//CHINA001 } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 #define SET_CMD(i,id) x +//CHINA001 aCmd = aDel; x +//CHINA001 aCmd += ScGlobal::GetRscString( id ); x +//CHINA001 aCmd += aDel; x +//CHINA001 aCmdArr[i] = aCmd; +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 void ScHFEditPage::FillCmdArr() +//CHINA001 { +//CHINA001 String aDel( ScGlobal::GetRscString( STR_HFCMD_DELIMITER ) ); +//CHINA001 String aCmd; +//CHINA001 +//CHINA001 SET_CMD( 0, STR_HFCMD_PAGE ) +//CHINA001 SET_CMD( 1, STR_HFCMD_PAGES ) +//CHINA001 SET_CMD( 2, STR_HFCMD_DATE ) +//CHINA001 SET_CMD( 3, STR_HFCMD_TIME ) +//CHINA001 SET_CMD( 4, STR_HFCMD_FILE ) +//CHINA001 SET_CMD( 5, STR_HFCMD_TABLE ) +//CHINA001 } +//CHINA001 +//CHINA001 #undef SET_CMD +//CHINA001 +//CHINA001 //----------------------------------------------------------------------- +//CHINA001 // Handler: +//CHINA001 //----------------------------------------------------------------------- +//CHINA001 +//CHINA001 IMPL_LINK( ScHFEditPage, ClickHdl, ImageButton*, pBtn ) +//CHINA001 { +//CHINA001 if ( !pActiveEdWnd ) +//CHINA001 return 0; +//CHINA001 +//CHINA001 if ( pBtn == &aBtnText ) +//CHINA001 { +//CHINA001 pActiveEdWnd->SetCharAttriutes(); +//CHINA001 } +//CHINA001 else +//CHINA001 { +//CHINA001 if ( pBtn == &aBtnPage ) +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem(SvxPageField()) ); +//CHINA001 else if ( pBtn == &aBtnLastPage ) +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem(SvxPagesField()) ); +//CHINA001 else if ( pBtn == &aBtnDate ) +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem(SvxDateField(Date(),SVXDATETYPE_VAR)) ); +//CHINA001 else if ( pBtn == &aBtnTime ) +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem(SvxTimeField()) ); +//CHINA001 else if ( pBtn == &aBtnFile ) +//CHINA001 { +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem( SvxFileField() ) ); +//CHINA001 } +//CHINA001 else if ( pBtn == &aBtnTable ) +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem(SvxTableField()) ); +//CHINA001 } +//CHINA001 pActiveEdWnd->GrabFocus(); +//CHINA001 +//CHINA001 return 0; +//CHINA001 } +//CHINA001 +//CHINA001 IMPL_LINK( ScHFEditPage, MenuHdl, ScExtIButton*, pBtn ) +//CHINA001 { +//CHINA001 if ( !pActiveEdWnd ) +//CHINA001 return 0; +//CHINA001 +//CHINA001 if(pBtn!=NULL) +//CHINA001 { +//CHINA001 switch(pBtn->GetSelected()) +//CHINA001 { +//CHINA001 case FILE_COMMAND_TITEL: +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem( SvxFileField() ) ); +//CHINA001 break; +//CHINA001 case FILE_COMMAND_FILENAME: +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem( SvxExtFileField( +//CHINA001 EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT ) ) ); +//CHINA001 break; +//CHINA001 case FILE_COMMAND_PATH: +//CHINA001 pActiveEdWnd->InsertField( SvxFieldItem( SvxExtFileField( +//CHINA001 EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_FULLPATH ) ) ); +//CHINA001 break; +//CHINA001 } +//CHINA001 } +//CHINA001 return 0; +//CHINA001 } +//CHINA001 +//CHINA001 //======================================================================== +//CHINA001 // class ScRightHeaderEditPage +//CHINA001 //======================================================================== +//CHINA001 +//CHINA001 ScRightHeaderEditPage::ScRightHeaderEditPage( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 : ScHFEditPage( pParent, RID_SCPAGE_HFED_HR, rCoreSet, +//CHINA001 rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERRIGHT) ) +//CHINA001 {} +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 USHORT* __EXPORT ScRightHeaderEditPage::GetRanges() +//CHINA001 { return pPageRightHeaderRanges; } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 SfxTabPage* __EXPORT ScRightHeaderEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 { return ( new ScRightHeaderEditPage( pParent, rCoreSet ) ); }; +//CHINA001 +//CHINA001 +//CHINA001 //======================================================================== +//CHINA001 // class ScLeftHeaderEditPage +//CHINA001 //======================================================================== +//CHINA001 +//CHINA001 ScLeftHeaderEditPage::ScLeftHeaderEditPage( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 : ScHFEditPage( pParent, RID_SCPAGE_HFED_HL, rCoreSet, +//CHINA001 rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERLEFT) ) +//CHINA001 {} +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 USHORT* __EXPORT ScLeftHeaderEditPage::GetRanges() +//CHINA001 { return pPageLeftHeaderRanges; } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 SfxTabPage* __EXPORT ScLeftHeaderEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 { return ( new ScLeftHeaderEditPage( pParent, rCoreSet ) ); }; +//CHINA001 +//CHINA001 //======================================================================== +//CHINA001 // class ScRightFooterEditPage +//CHINA001 //======================================================================== +//CHINA001 +//CHINA001 ScRightFooterEditPage::ScRightFooterEditPage( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 : ScHFEditPage( pParent, RID_SCPAGE_HFED_FR, rCoreSet, +//CHINA001 rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERRIGHT) ) +//CHINA001 {} +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 USHORT* __EXPORT ScRightFooterEditPage::GetRanges() +//CHINA001 { return pPageRightFooterRanges; } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 SfxTabPage* __EXPORT ScRightFooterEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 { return ( new ScRightFooterEditPage( pParent, rCoreSet ) ); }; +//CHINA001 +//CHINA001 //======================================================================== +//CHINA001 // class ScLeftFooterEditPage +//CHINA001 //======================================================================== +//CHINA001 +//CHINA001 ScLeftFooterEditPage::ScLeftFooterEditPage( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 : ScHFEditPage( pParent, RID_SCPAGE_HFED_FL, rCoreSet, +//CHINA001 rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERLEFT) ) +//CHINA001 {} +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 USHORT* __EXPORT ScLeftFooterEditPage::GetRanges() +//CHINA001 { return pPageLeftFooterRanges; } +//CHINA001 +//CHINA001 // ----------------------------------------------------------------------- +//CHINA001 +//CHINA001 SfxTabPage* __EXPORT ScLeftFooterEditPage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +//CHINA001 { return ( new ScLeftFooterEditPage( pParent, rCoreSet ) ); }; + +//======================================================================== + +void lcl_GetFieldData( ScHeaderFieldData& rData ) +{ + SfxViewShell* pShell = SfxViewShell::Current(); + if (pShell) + { + if (pShell->ISA(ScTabViewShell)) + ((ScTabViewShell*)pShell)->FillFieldData(rData); + else if (pShell->ISA(ScPreviewShell)) + ((ScPreviewShell*)pShell)->FillFieldData(rData); + } +} + +//======================================================================== +// class ScEditWindow +//======================================================================== + +ScEditWindow::ScEditWindow( Window* pParent, const ResId& rResId, ScEditWindowLocation eLoc ) + : Control( pParent, rResId ), + eLocation(eLoc), + pAcc(NULL) +{ + EnableRTL(FALSE); + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aBgColor = rStyleSettings.GetWindowColor(); + + SetMapMode( MAP_TWIP ); + SetPointer( POINTER_TEXT ); + SetBackground( aBgColor ); + + Size aSize( GetOutputSize() ); + aSize.Height() *= 4; + + pEdEngine = new ScHeaderEditEngine( EditEngine::CreatePool(), TRUE ); + pEdEngine->SetPaperSize( aSize ); + pEdEngine->SetRefDevice( this ); + + ScHeaderFieldData aData; + lcl_GetFieldData( aData ); + + // Feldbefehle: + pEdEngine->SetData( aData ); + pEdEngine->SetControlWord( pEdEngine->GetControlWord() | EE_CNTRL_MARKFIELDS ); + mbRTL = ScGlobal::IsSystemRTL(); + if (mbRTL) + pEdEngine->SetDefaultHorizontalTextDirection(EE_HTEXTDIR_R2L); + + pEdView = new EditView( pEdEngine, this ); + pEdView->SetOutputArea( Rectangle( Point(0,0), GetOutputSize() ) ); + + pEdView->SetBackgroundColor( aBgColor ); + pEdEngine->InsertView( pEdView ); +} + +// ----------------------------------------------------------------------- + +__EXPORT ScEditWindow::~ScEditWindow() +{ + // delete Accessible object before deleting EditEngine and EditView + if (pAcc) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTemp = xAcc; + if (xTemp.is()) + pAcc->dispose(); + } + delete pEdEngine; + delete pEdView; +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::SetNumType(SvxNumType eNumType) +{ + pEdEngine->SetNumType(eNumType); + pEdEngine->UpdateFields(); +} + +// ----------------------------------------------------------------------- + +EditTextObject* __EXPORT ScEditWindow::CreateTextObject() +{ + // wegen #38841# die Absatzattribute zuruecksetzen + // (GetAttribs beim Format-Dialog-Aufruf gibt immer gesetzte Items zurueck) + + const SfxItemSet& rEmpty = pEdEngine->GetEmptyItemSet(); + USHORT nParCnt = pEdEngine->GetParagraphCount(); + for (USHORT i=0; i<nParCnt; i++) + pEdEngine->SetParaAttribs( i, rEmpty ); + + return pEdEngine->CreateTextObject(); +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::SetFont( const ScPatternAttr& rPattern ) +{ + SfxItemSet* pSet = new SfxItemSet( pEdEngine->GetEmptyItemSet() ); + rPattern.FillEditItemSet( pSet ); + // FillEditItemSet adjusts font height to 1/100th mm, + // but for header/footer twips is needed, as in the PatternAttr: + pSet->Put( rPattern.GetItem(ATTR_FONT_HEIGHT), EE_CHAR_FONTHEIGHT ); + pSet->Put( rPattern.GetItem(ATTR_CJK_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CJK ); + pSet->Put( rPattern.GetItem(ATTR_CTL_FONT_HEIGHT), EE_CHAR_FONTHEIGHT_CTL ); + if (mbRTL) + pSet->Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + pEdEngine->SetDefaults( pSet ); +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::SetText( const EditTextObject& rTextObject ) +{ + pEdEngine->SetText( rTextObject ); +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::InsertField( const SvxFieldItem& rFld ) +{ + pEdView->InsertField( rFld ); +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::SetCharAttriutes() +{ + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + + SfxViewShell* pViewSh = SfxViewShell::Current(); + + ScTabViewShell* pTabViewSh = PTR_CAST(ScTabViewShell, SfxViewShell::Current()); + + + DBG_ASSERT( pDocSh, "Current DocShell not found" ); + DBG_ASSERT( pViewSh, "Current ViewShell not found" ); + + if ( pDocSh && pViewSh ) + { + if(pTabViewSh!=NULL) pTabViewSh->SetInFormatDialog(TRUE); + + SfxItemSet aSet( pEdView->GetAttribs() ); + + //CHINA001 ScCharDlg* pDlg = new ScCharDlg( GetParent(), &aSet, pDocSh ); + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 + + SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( GetParent(), &aSet, + pDocSh,RID_SCDLG_CHAR ); + DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 + pDlg->SetText( ScGlobal::GetRscString( STR_TEXTATTRS ) ); + if ( pDlg->Execute() == RET_OK ) + { + aSet.ClearItem(); + aSet.Put( *pDlg->GetOutputItemSet() ); + pEdView->SetAttribs( aSet ); + } + + if(pTabViewSh!=NULL) pTabViewSh->SetInFormatDialog(FALSE); + delete pDlg; + } +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::Paint( const Rectangle& rRec ) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aBgColor = rStyleSettings.GetWindowColor(); + + pEdView->SetBackgroundColor( aBgColor ); + + SetBackground( aBgColor ); + + Control::Paint( rRec ); + + pEdView->Paint( rRec ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::MouseMove( const MouseEvent& rMEvt ) +{ + pEdView->MouseMove( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if ( !HasFocus() ) + GrabFocus(); + + pEdView->MouseButtonDown( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::MouseButtonUp( const MouseEvent& rMEvt ) +{ + pEdView->MouseButtonUp( rMEvt ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::KeyInput( const KeyEvent& rKEvt ) +{ + USHORT nKey = rKEvt.GetKeyCode().GetModifier() + + rKEvt.GetKeyCode().GetCode(); + + if ( nKey == KEY_TAB || nKey == KEY_TAB + KEY_SHIFT ) + { + Control::KeyInput( rKEvt ); + } + else if ( !pEdView->PostKeyEvent( rKEvt ) ) + { + Control::KeyInput( rKEvt ); + } +} + +// ----------------------------------------------------------------------- + +void ScEditWindow::Command( const CommandEvent& rCEvt ) +{ + pEdView->Command( rCEvt ); +} + +// ----------------------------------------------------------------------- + +void __EXPORT ScEditWindow::GetFocus() +{ + pActiveEdWnd = this; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTemp = xAcc; + if (xTemp.is() && pAcc) + { + pAcc->GotFocus(); + } + else + pAcc = NULL; +} + +void __EXPORT ScEditWindow::LoseFocus() +{ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTemp = xAcc; + if (xTemp.is() && pAcc) + { + pAcc->LostFocus(); + } + else + pAcc = NULL; +} + +// ----------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ScEditWindow::CreateAccessible() +{ + String sName; + String sDescription(GetHelpText()); + switch (eLocation) + { + case Left: + { + sName = String(ScResId(STR_ACC_LEFTAREA_NAME)); +// sDescription = String(ScResId(STR_ACC_LEFTAREA_DESCR)); + } + break; + case Center: + { + sName = String(ScResId(STR_ACC_CENTERAREA_NAME)); +// sDescription = String(ScResId(STR_ACC_CENTERAREA_DESCR)); + } + break; + case Right: + { + sName = String(ScResId(STR_ACC_RIGHTAREA_NAME)); +// sDescription = String(ScResId(STR_ACC_RIGHTAREA_DESCR)); + } + break; + } + pAcc = new ScAccessibleEditObject(GetAccessibleParentWindow()->GetAccessible(), pEdView, this, + rtl::OUString(sName), rtl::OUString(sDescription), EditControl); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible = pAcc; + xAcc = xAccessible; + return pAcc; +} + +/* +class ScExtIButton : public ImageButton +{ +private: + + Timer aTimer; + ScPopupMenu* pPopupMenu; + + DECL_LINK( TimerHdl, Timer*); + + void DrawArrow(); + +protected: + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt); + + virtual void StartPopup(); + +public: + + ScExtIButton(Window* pParent, const ResId& rResId ); + + void SetPopupMenu(ScPopupMenu* pPopUp); + + USHORT GetSelected(); + + void SetMenuHdl( const Link& rLink ) { aFxLink = rLink; } + const Link& GetMenuHdl() const { return aFxLink; } + +} +*/ +ScExtIButton::ScExtIButton(Window* pParent, const ResId& rResId ) +: ImageButton(pParent,rResId), + pPopupMenu(NULL) +{ + nSelected=0; + aTimer.SetTimeout(600); + SetDropDown( TRUE); + +// DrawArrow(); +} + +void ScExtIButton::SetPopupMenu(ScPopupMenu* pPopUp) +{ + pPopupMenu=pPopUp; +} + +USHORT ScExtIButton::GetSelected() +{ + return nSelected; +} + +void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if(!aTimer.IsActive()) + { + aTimer.Start(); + aTimer.SetTimeoutHdl(LINK( this, ScExtIButton, TimerHdl)); + } + + ImageButton::MouseButtonDown(rMEvt ); +} +void ScExtIButton::MouseButtonUp( const MouseEvent& rMEvt) +{ + aTimer.Stop(); + aTimer.SetTimeoutHdl(Link()); + ImageButton::MouseButtonUp(rMEvt ); +} + +void ScExtIButton::Click() +{ + aTimer.Stop(); + aTimer.SetTimeoutHdl(Link()); + ImageButton::Click(); +} + +void ScExtIButton::StartPopup() +{ + nSelected=0; + + if(pPopupMenu!=NULL) + { + SetPressed( TRUE ); + EndSelection(); + Point aPoint(0,0); + aPoint.Y()=GetOutputSizePixel().Height(); + + nSelected=pPopupMenu->Execute( this, aPoint ); + + if(nSelected) + { + aMLink.Call(this); + } + SetPressed( FALSE); + } +} + +long ScExtIButton::PreNotify( NotifyEvent& rNEvt ) +{ + USHORT nSwitch=rNEvt.GetType(); + if(nSwitch==EVENT_MOUSEBUTTONUP) + { + MouseButtonUp(*rNEvt.GetMouseEvent()); + } + + return ImageButton::PreNotify(rNEvt ); +} + +IMPL_LINK( ScExtIButton, TimerHdl, Timer*, EMPTYARG ) +{ + StartPopup(); + return 0; +} + +/* +static void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, BOOL bBlack, + BOOL bLeft = FALSE, BOOL bTop = FALSE ) +{ + Color aOldFillColor = pBox->GetFillColor(); + WindowAlign eAlign = pBox->meAlign; + if ( bLeft ) + eAlign = WINDOWALIGN_RIGHT; + else if ( bTop ) + eAlign = WINDOWALIGN_BOTTOM; + + switch ( eAlign ) + { + case WINDOWALIGN_LEFT: + if ( bBlack ) + pBox->SetFillColor( Color( COL_BLACK ) ); + pBox->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) ); + pBox->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) ); + pBox->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); + pBox->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); + if ( bBlack ) + { + pBox->SetFillColor( aOldFillColor ); + pBox->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); + pBox->DrawRect( Rectangle( nX+2, nY+3, nX+2, nY+3 ) ); + } + break; + case WINDOWALIGN_TOP: + if ( bBlack ) + pBox->SetFillColor( Color( COL_BLACK ) ); + pBox->DrawRect( Rectangle( nX+0, nY+0, nX+6, nY+0 ) ); + pBox->DrawRect( Rectangle( nX+1, nY+1, nX+5, nY+1 ) ); + pBox->DrawRect( Rectangle( nX+2, nY+2, nX+4, nY+2 ) ); + pBox->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) ); + if ( bBlack ) + { + pBox->SetFillColor( aOldFillColor ); + pBox->DrawRect( Rectangle( nX+2, nY+1, nX+4, nY+1 ) ); + pBox->DrawRect( Rectangle( nX+3, nY+2, nX+3, nY+2 ) ); + } + break; + case WINDOWALIGN_RIGHT: + if ( bBlack ) + pBox->SetFillColor( Color( COL_BLACK ) ); + pBox->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) ); + pBox->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) ); + pBox->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) ); + pBox->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) ); + if ( bBlack ) + { + pBox->SetFillColor( aOldFillColor ); + pBox->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) ); + pBox->DrawRect( Rectangle( nX+1, nY+3, nX+1, nY+3 ) ); + } + break; + case WINDOWALIGN_BOTTOM: + if ( bBlack ) + pBox->SetFillColor( Color( COL_BLACK ) ); + pBox->DrawRect( Rectangle( nX+0, nY+3, nX+6, nY+3 ) ); + pBox->DrawRect( Rectangle( nX+1, nY+2, nX+5, nY+2 ) ); + pBox->DrawRect( Rectangle( nX+2, nY+1, nX+4, nY+1 ) ); + pBox->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+0 ) ); + if ( bBlack ) + { + pBox->SetFillColor( aOldFillColor ); + pBox->DrawRect( Rectangle( nX+2, nY+2, nX+4, nY+2 ) ); + pBox->DrawRect( Rectangle( nX+3, nY+1, nX+3, nY+1 ) ); + } + break; + } +} +Down + - Timer starten + +Click + - Timer abbrechen + +Timer + if ( ??? ) + { + - SetPressed( TRUE ); + - EndSelection(); + - Menu anzeigen + - SetPressed( FALSE ); + } + + +*/ + + diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx new file mode 100644 index 000000000000..a2b732464e12 --- /dev/null +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -0,0 +1,570 @@ +/************************************************************************* + * + * 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_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + + + +//------------------------------------------------------------------ + +#include "scitems.hxx" + +#include "tptable.hxx" +#include "global.hxx" +#include "attrib.hxx" +#include "scresid.hxx" +#include "sc.hrc" +#include "pagedlg.hrc" + +// ======================================================================= + +void EmptyNumericField::Modify() +{ + if( GetText().Len() ) + NumericField::Modify(); + else + SetEmptyFieldValue(); +} + +void EmptyNumericField::SetValue( sal_Int64 nValue ) +{ + if( nValue == 0 ) + SetEmptyFieldValue(); + else + NumericField::SetValue( nValue ); +} + +sal_Int64 EmptyNumericField::GetValue() const +{ + return IsEmptyFieldValue() ? 0 : NumericField::GetValue(); +} + +// ======================================================================= + +// STATIC DATA ----------------------------------------------------------- + +static USHORT pPageTableRanges[] = +{ + ATTR_PAGE_NOTES, ATTR_PAGE_FIRSTPAGENO, + 0 +}; + +BOOL lcl_PutVObjModeItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const CheckBox& rBtn ); + +BOOL lcl_PutScaleItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const ListBox& rListBox, + USHORT nLBEntry, + const SpinField& rEd, + UINT16 nValue ); + +BOOL lcl_PutScaleItem2( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const ListBox& rListBox, + USHORT nLBEntry, + const NumericField& rEd1, + const NumericField& rEd2 ); + +BOOL lcl_PutBoolItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + BOOL bIsChecked, + BOOL bSavedValue ); + +//------------------------------------------------------------------------ + +#define PAGENO_HDL LINK(this,ScTablePage,PageNoHdl) +#define PAGEDIR_HDL LINK(this,ScTablePage,PageDirHdl) +#define SCALE_HDL LINK(this,ScTablePage,ScaleHdl) + +#define WAS_DEFAULT(w,s) (SFX_ITEM_DEFAULT==(s).GetItemState((w),TRUE)) +#define GET_BOOL(sid,set) ((const SfxBoolItem&)((set).Get(GetWhich((sid))))).GetValue() +#define GET_USHORT(sid,set) (USHORT)((const SfxUInt16Item&)((set).Get(GetWhich((sid))))).GetValue() +#define GET_SHOW(sid,set) ( ScVObjMode( ((const ScViewObjectModeItem&)((set).Get(GetWhich((sid))))).GetValue() ) \ + == VOBJ_MODE_SHOW ) + +//======================================================================== + +ScTablePage::ScTablePage( Window* pParent, const SfxItemSet& rCoreAttrs ) : + + SfxTabPage( pParent, ScResId( RID_SCPAGE_TABLE ), rCoreAttrs ), + + aFlPageDir ( this, ScResId( FL_PAGEDIR ) ), + aBtnTopDown ( this, ScResId( BTN_TOPDOWN ) ), + aBtnLeftRight ( this, ScResId( BTN_LEFTRIGHT ) ), + aBmpPageDir ( this, ScResId( BMP_PAGEDIR ) ), + aImgLeftRight ( ScResId( IMG_LEFTRIGHT ) ), + aImgTopDown ( ScResId( IMG_TOPDOWN ) ), + aImgLeftRightHC ( ScResId( IMG_LEFTRIGHT_H ) ), + aImgTopDownHC ( ScResId( IMG_TOPDOWN_H ) ), + aBtnPageNo ( this, ScResId( BTN_PAGENO ) ), + aEdPageNo ( this, ScResId( ED_PAGENO ) ), + aFlPrint ( this, ScResId( FL_PRINT ) ), + aBtnHeaders ( this, ScResId( BTN_HEADER ) ), + aBtnGrid ( this, ScResId( BTN_GRID ) ), + aBtnNotes ( this, ScResId( BTN_NOTES ) ), + aBtnObjects ( this, ScResId( BTN_OBJECTS ) ), + aBtnCharts ( this, ScResId( BTN_CHARTS ) ), + aBtnDrawings ( this, ScResId( BTN_DRAWINGS ) ), + aBtnFormulas ( this, ScResId( BTN_FORMULAS ) ), + aBtnNullVals ( this, ScResId( BTN_NULLVALS ) ), + aFlScale ( this, ScResId( FL_SCALE ) ), + aFtScaleMode ( this, ScResId( FT_SCALEMODE ) ), + aLbScaleMode ( this, ScResId( LB_SCALEMODE ) ), + aFtScaleAll ( this, ScResId( FT_SCALEFACTOR ) ), + aEdScaleAll ( this, ScResId( ED_SCALEALL ) ), + aFtScalePageWidth ( this, ScResId( FT_SCALEPAGEWIDTH ) ), + aEdScalePageWidth ( this, ScResId( ED_SCALEPAGEWIDTH ) ), + aFtScalePageHeight ( this, ScResId( FT_SCALEPAGEHEIGHT ) ), + aEdScalePageHeight ( this, ScResId( ED_SCALEPAGEHEIGHT ) ), + aFtScalePageNum ( this, ScResId( FT_SCALEPAGENUM ) ), + aEdScalePageNum ( this, ScResId( ED_SCALEPAGENUM ) ) +{ + SetExchangeSupport(); + aBtnPageNo.SetClickHdl( PAGENO_HDL ); + aBtnTopDown.SetClickHdl( PAGEDIR_HDL ); + aBtnLeftRight.SetClickHdl( PAGEDIR_HDL ); + aLbScaleMode.SetSelectHdl( SCALE_HDL ); + + Size aBmpSize = Image( ScResId( IMG_LEFTRIGHT ) ).GetSizePixel(); + aBmpPageDir.SetOutputSizePixel( aBmpSize ); + + FreeResource(); +} + +// ----------------------------------------------------------------------- + +void ScTablePage::ShowImage() +{ + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + bool bLeftRight = aBtnLeftRight.IsChecked(); + aBmpPageDir.SetImage( bHC ? + (bLeftRight ? aImgLeftRightHC : aImgTopDownHC) : + (bLeftRight ? aImgLeftRight : aImgTopDown) ); +} + +// ----------------------------------------------------------------------- + +ScTablePage::~ScTablePage() +{ +} + +//------------------------------------------------------------------------ + +USHORT* ScTablePage::GetRanges() +{ + return pPageTableRanges; +} + +// ----------------------------------------------------------------------- + +SfxTabPage* ScTablePage::Create( Window* pParent, const SfxItemSet& rCoreSet ) +{ + return ( new ScTablePage( pParent, rCoreSet ) ); +} + +// ----------------------------------------------------------------------- + +void ScTablePage::Reset( const SfxItemSet& rCoreSet ) +{ + BOOL bTopDown = GET_BOOL( SID_SCATTR_PAGE_TOPDOWN, rCoreSet ); + USHORT nWhich = 0; + + //----------- + // BOOL-Flags + //----------- + aBtnNotes .Check( GET_BOOL(SID_SCATTR_PAGE_NOTES,rCoreSet) ); + aBtnGrid .Check( GET_BOOL(SID_SCATTR_PAGE_GRID,rCoreSet) ); + aBtnHeaders .Check( GET_BOOL(SID_SCATTR_PAGE_HEADERS,rCoreSet) ); + aBtnFormulas .Check( GET_BOOL(SID_SCATTR_PAGE_FORMULAS,rCoreSet) ); + aBtnNullVals .Check( GET_BOOL(SID_SCATTR_PAGE_NULLVALS,rCoreSet) ); + aBtnTopDown .Check( bTopDown ); + aBtnLeftRight .Check( !bTopDown ); + + //------------------ + // Erste Druckseite: + //------------------ + USHORT nPage = GET_USHORT(SID_SCATTR_PAGE_FIRSTPAGENO,rCoreSet); + aBtnPageNo.Check( nPage != 0 ); + aEdPageNo.SetValue( (nPage != 0) ? nPage : 1 ); + PageNoHdl( NULL ); + + //------------------- + // Objektdarstellung: + //------------------- + aBtnCharts .Check( GET_SHOW( SID_SCATTR_PAGE_CHARTS, rCoreSet ) ); + aBtnObjects .Check( GET_SHOW( SID_SCATTR_PAGE_OBJECTS, rCoreSet ) ); + aBtnDrawings .Check( GET_SHOW( SID_SCATTR_PAGE_DRAWINGS, rCoreSet ) ); + + //------------ + // Skalierung: + //------------ + + nWhich = GetWhich(SID_SCATTR_PAGE_SCALE); + if ( rCoreSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE ) + { + USHORT nScale = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue(); + if( nScale > 0 ) + aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT ); + aEdScaleAll.SetValue( (nScale > 0) ? nScale : 100 ); + } + + nWhich = GetWhich(SID_SCATTR_PAGE_SCALETO); + if ( rCoreSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE ) + { + const ScPageScaleToItem& rItem = static_cast< const ScPageScaleToItem& >( rCoreSet.Get( nWhich ) ); + USHORT nWidth = rItem.GetWidth(); + USHORT nHeight = rItem.GetHeight(); + + /* width==0 and height==0 is invalid state, used as "not selected". + Dialog shows width=height=1 then. */ + bool bValid = nWidth || nHeight; + if( bValid ) + aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_TO ); + aEdScalePageWidth.SetValue( bValid ? nWidth : 1 ); + aEdScalePageHeight.SetValue( bValid ? nHeight : 1 ); + } + + nWhich = GetWhich(SID_SCATTR_PAGE_SCALETOPAGES); + if ( rCoreSet.GetItemState( nWhich, TRUE ) >= SFX_ITEM_AVAILABLE ) + { + USHORT nPages = ((const SfxUInt16Item&)rCoreSet.Get(nWhich)).GetValue(); + if( nPages > 0 ) + aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_TO_PAGES ); + aEdScalePageNum.SetValue( (nPages > 0) ? nPages : 1 ); + } + + if( aLbScaleMode.GetSelectEntryCount() == 0 ) + { + // fall back to 100% + DBG_ERRORFILE( "ScTablePage::Reset - missing scaling item" ); + aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT ); + aEdScaleAll.SetValue( 100 ); + } + + PageDirHdl( NULL ); + ScaleHdl( NULL ); + + // merken fuer FillItemSet + aBtnFormulas .SaveValue(); + aBtnNullVals .SaveValue(); + aBtnNotes .SaveValue(); + aBtnGrid .SaveValue(); + aBtnHeaders .SaveValue(); + aBtnTopDown .SaveValue(); + aBtnLeftRight .SaveValue(); + aLbScaleMode .SaveValue(); + aBtnCharts .SaveValue(); + aBtnObjects .SaveValue(); + aBtnDrawings .SaveValue(); + aBtnPageNo .SaveValue(); + aEdPageNo .SaveValue(); + aEdScaleAll .SaveValue(); + aEdScalePageWidth.SaveValue(); + aEdScalePageHeight.SaveValue(); + aEdScalePageNum .SaveValue(); +} + +// ----------------------------------------------------------------------- + +BOOL ScTablePage::FillItemSet( SfxItemSet& rCoreSet ) +{ + const SfxItemSet& rOldSet = GetItemSet(); + USHORT nWhichPageNo = GetWhich(SID_SCATTR_PAGE_FIRSTPAGENO); + BOOL bDataChanged = FALSE; + + //----------- + // BOOL-Flags + //----------- + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NOTES), + rCoreSet, rOldSet, + aBtnNotes.IsChecked(), + aBtnNotes.GetSavedValue() != STATE_NOCHECK ); + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_GRID), + rCoreSet, rOldSet, + aBtnGrid.IsChecked(), + aBtnGrid.GetSavedValue() != STATE_NOCHECK ); + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_HEADERS), + rCoreSet, rOldSet, + aBtnHeaders.IsChecked(), + aBtnHeaders.GetSavedValue() != STATE_NOCHECK ); + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_TOPDOWN), + rCoreSet, rOldSet, + aBtnTopDown.IsChecked(), + aBtnTopDown.GetSavedValue() ); + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_FORMULAS), + rCoreSet, rOldSet, + aBtnFormulas.IsChecked(), + aBtnFormulas.GetSavedValue() != STATE_NOCHECK ); + + bDataChanged |= lcl_PutBoolItem( GetWhich(SID_SCATTR_PAGE_NULLVALS), + rCoreSet, rOldSet, + aBtnNullVals.IsChecked(), + aBtnNullVals.GetSavedValue() != STATE_NOCHECK ); + + //------------------ + // Erste Druckseite: + //------------------ + BOOL bUseValue = aBtnPageNo.IsChecked(); + + if ( WAS_DEFAULT(nWhichPageNo,rOldSet) + && ( (!bUseValue && bUseValue == aBtnPageNo.GetSavedValue()) + || ( bUseValue && bUseValue == aBtnPageNo.GetSavedValue() + && aEdPageNo.GetText() == aEdPageNo.GetSavedValue() ) ) ) + { + rCoreSet.ClearItem( nWhichPageNo ); + } + else + { + UINT16 nPage = (UINT16)( aBtnPageNo.IsChecked() + ? aEdPageNo.GetValue() + : 0 ); + + rCoreSet.Put( SfxUInt16Item( nWhichPageNo, nPage ) ); + bDataChanged = TRUE; + } + + //------------------- + // Objektdarstellung: + //------------------- + + bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_CHARTS), + rCoreSet, rOldSet, aBtnCharts ); + + bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_OBJECTS), + rCoreSet, rOldSet, aBtnObjects ); + + bDataChanged |= lcl_PutVObjModeItem( GetWhich(SID_SCATTR_PAGE_DRAWINGS), + rCoreSet, rOldSet, aBtnDrawings ); + + //------------ + // Skalierung: + //------------ + + if( !aEdScalePageWidth.GetValue() && !aEdScalePageHeight.GetValue() ) + { + aLbScaleMode.SelectEntryPos( SC_TPTABLE_SCALE_PERCENT ); + aEdScaleAll.SetValue( 100 ); + } + + bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALE), + rCoreSet, rOldSet, + aLbScaleMode, SC_TPTABLE_SCALE_PERCENT, + aEdScaleAll, (UINT16)aEdScaleAll.GetValue() ); + + bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO), + rCoreSet, rOldSet, + aLbScaleMode, SC_TPTABLE_SCALE_TO, + aEdScalePageWidth, aEdScalePageHeight ); + + bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES), + rCoreSet, rOldSet, + aLbScaleMode, SC_TPTABLE_SCALE_TO_PAGES, + aEdScalePageNum, (UINT16)aEdScalePageNum.GetValue() ); + + return bDataChanged; +} + +//------------------------------------------------------------------------ + +int ScTablePage::DeactivatePage( SfxItemSet* pSetP ) +{ + if ( pSetP ) + FillItemSet( *pSetP ); + + return LEAVE_PAGE; +} + +//------------------------------------------------------------------------ + +void ScTablePage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + ShowImage(); + SfxTabPage::DataChanged( rDCEvt ); +} + +//------------------------------------------------------------------------ +// Handler: +//------------------------------------------------------------------------ + +IMPL_LINK( ScTablePage, PageDirHdl, RadioButton*, EMPTYARG ) +{ + ShowImage(); + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( ScTablePage, PageNoHdl, CheckBox*, pBtn ) +{ + if ( aBtnPageNo.IsChecked() ) + { + aEdPageNo.Enable(); + if ( pBtn ) + aEdPageNo.GrabFocus(); + } + else + aEdPageNo.Disable(); + + return 0; +} + +//------------------------------------------------------------------------ + +IMPL_LINK( ScTablePage, ScaleHdl, ListBox*, EMPTYARG ) +{ + // controls for "Reduce/enlarge" + bool bPercent = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_PERCENT); + aFtScaleAll.Show( bPercent ); + aEdScaleAll.Show( bPercent ); + + // controls for "Scale to width/height" + bool bScaleTo = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_TO); + aFtScalePageWidth.Show( bScaleTo ); + aEdScalePageWidth.Show( bScaleTo ); + aFtScalePageHeight.Show( bScaleTo ); + aEdScalePageHeight.Show( bScaleTo ); + + // controls for "Scale to pages" + bool bScalePages = (aLbScaleMode.GetSelectEntryPos() == SC_TPTABLE_SCALE_TO_PAGES); + aFtScalePageNum.Show( bScalePages ); + aEdScalePageNum.Show( bScalePages ); + + return 0; +} + +//======================================================================== +// Hilfsfunktionen fuer FillItemSet: +//======================================================================== + +BOOL lcl_PutBoolItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + BOOL bIsChecked, + BOOL bSavedValue ) +{ + BOOL bDataChanged = ( bSavedValue == bIsChecked + && WAS_DEFAULT(nWhich,rOldSet) ); + + if ( bDataChanged ) + rCoreSet.ClearItem(nWhich); + else + rCoreSet.Put( SfxBoolItem( nWhich, bIsChecked ) ); + + return bDataChanged; +} + +//------------------------------------------------------------------------ + +BOOL lcl_PutVObjModeItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const CheckBox& rBtn ) +{ + BOOL bIsChecked = rBtn.IsChecked(); + BOOL bDataChanged = ( rBtn.GetSavedValue() == bIsChecked + && WAS_DEFAULT(nWhich,rOldSet) ); + + if ( bDataChanged ) + rCoreSet.ClearItem( nWhich ); + + else + rCoreSet.Put( ScViewObjectModeItem( nWhich, bIsChecked + ? VOBJ_MODE_SHOW + : VOBJ_MODE_HIDE ) ); + return bDataChanged; +} + +//------------------------------------------------------------------------ + +BOOL lcl_PutScaleItem( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const ListBox& rListBox, + USHORT nLBEntry, + const SpinField& rEd, + UINT16 nValue ) +{ + BOOL bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry); + BOOL bDataChanged = (rListBox.GetSavedValue() != nLBEntry) || + (rEd.GetSavedValue() != rEd.GetText()) || + !WAS_DEFAULT( nWhich, rOldSet ); + + if( bDataChanged ) + rCoreSet.Put( SfxUInt16Item( nWhich, bIsSel ? nValue : 0 ) ); + else + rCoreSet.ClearItem( nWhich ); + + return bDataChanged; +} + + +BOOL lcl_PutScaleItem2( USHORT nWhich, + SfxItemSet& rCoreSet, + const SfxItemSet& rOldSet, + const ListBox& rListBox, + USHORT nLBEntry, + const NumericField& rEd1, + const NumericField& rEd2 ) +{ + UINT16 nValue1 = (UINT16)rEd1.GetValue(); + UINT16 nValue2 = (UINT16)rEd2.GetValue(); + BOOL bIsSel = (rListBox.GetSelectEntryPos() == nLBEntry); + BOOL bDataChanged = (rListBox.GetSavedValue() != nLBEntry) || + (rEd1.GetSavedValue() != rEd1.GetText()) || + (rEd2.GetSavedValue() != rEd2.GetText()) || + !WAS_DEFAULT( nWhich, rOldSet ); + + if( bDataChanged ) + { + ScPageScaleToItem aItem; + if( bIsSel ) + aItem.Set( nValue1, nValue2 ); + rCoreSet.Put( aItem ); + } + else + rCoreSet.ClearItem( nWhich ); + + return bDataChanged; +} + + + |