1ff0525f2SOliver-Rainer Wittmann /************************************************************** 2ff0525f2SOliver-Rainer Wittmann * 3ff0525f2SOliver-Rainer Wittmann * Licensed to the Apache Software Foundation (ASF) under one 4ff0525f2SOliver-Rainer Wittmann * or more contributor license agreements. See the NOTICE file 5ff0525f2SOliver-Rainer Wittmann * distributed with this work for additional information 6ff0525f2SOliver-Rainer Wittmann * regarding copyright ownership. The ASF licenses this file 7ff0525f2SOliver-Rainer Wittmann * to you under the Apache License, Version 2.0 (the 8ff0525f2SOliver-Rainer Wittmann * "License"); you may not use this file except in compliance 9ff0525f2SOliver-Rainer Wittmann * with the License. You may obtain a copy of the License at 10ff0525f2SOliver-Rainer Wittmann * 11ff0525f2SOliver-Rainer Wittmann * http://www.apache.org/licenses/LICENSE-2.0 12ff0525f2SOliver-Rainer Wittmann * 13ff0525f2SOliver-Rainer Wittmann * Unless required by applicable law or agreed to in writing, 14ff0525f2SOliver-Rainer Wittmann * software distributed under the License is distributed on an 15ff0525f2SOliver-Rainer Wittmann * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16ff0525f2SOliver-Rainer Wittmann * KIND, either express or implied. See the License for the 17ff0525f2SOliver-Rainer Wittmann * specific language governing permissions and limitations 18ff0525f2SOliver-Rainer Wittmann * under the License. 19ff0525f2SOliver-Rainer Wittmann * 20ff0525f2SOliver-Rainer Wittmann *************************************************************/ 21ff0525f2SOliver-Rainer Wittmann 22ff0525f2SOliver-Rainer Wittmann #include "precompiled_sw.hxx" 23ff0525f2SOliver-Rainer Wittmann 24ff0525f2SOliver-Rainer Wittmann #include "PageColumnControl.hxx" 25ff0525f2SOliver-Rainer Wittmann #include "PagePropertyPanel.hxx" 26ff0525f2SOliver-Rainer Wittmann #include "PagePropertyPanel.hrc" 27ff0525f2SOliver-Rainer Wittmann 28ff0525f2SOliver-Rainer Wittmann #include <cmdid.h> 29ff0525f2SOliver-Rainer Wittmann #include <swtypes.hxx> 30ff0525f2SOliver-Rainer Wittmann 31ff0525f2SOliver-Rainer Wittmann #include <svx/sidebar/ValueSetWithTextControl.hxx> 32*f120fe41SAndre Fischer #include <sfx2/bindings.hxx> 33*f120fe41SAndre Fischer #include <sfx2/dispatch.hxx> 34ff0525f2SOliver-Rainer Wittmann 35ff0525f2SOliver-Rainer Wittmann namespace sw { namespace sidebar { 36ff0525f2SOliver-Rainer Wittmann 37ff0525f2SOliver-Rainer Wittmann PageColumnControl::PageColumnControl( 38ff0525f2SOliver-Rainer Wittmann Window* pParent, 39ff0525f2SOliver-Rainer Wittmann PagePropertyPanel& rPanel, 40ff0525f2SOliver-Rainer Wittmann const sal_uInt16 nColumnType, 41ff0525f2SOliver-Rainer Wittmann const bool bLandscape ) 42ff0525f2SOliver-Rainer Wittmann : ::svx::sidebar::PopupControl( pParent, SW_RES(RID_POPUP_SWPAGE_COLUMN) ) 43ff0525f2SOliver-Rainer Wittmann , mpColumnValueSet( new ::svx::sidebar::ValueSetWithTextControl( ::svx::sidebar::ValueSetWithTextControl::IMAGE_TEXT, this, SW_RES(VS_COLUMN) ) ) 44ff0525f2SOliver-Rainer Wittmann , maMoreButton( this, SW_RES(CB_COLUMN_MORE) ) 45ff0525f2SOliver-Rainer Wittmann , mnColumnType( nColumnType ) 46ff0525f2SOliver-Rainer Wittmann , mrPagePropPanel(rPanel) 47ff0525f2SOliver-Rainer Wittmann { 48ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SetStyle( mpColumnValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); 49ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SetColor(GetSettings().GetStyleSettings().GetMenuColor()); 50ff0525f2SOliver-Rainer Wittmann 51ff0525f2SOliver-Rainer Wittmann if ( bLandscape ) 52ff0525f2SOliver-Rainer Wittmann { 53ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_ONE_L), 0, SW_RES(STR_ONE), 0 ); 54ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_TWO_L), 0, SW_RES(STR_TWO), 0 ); 55ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_THREE_L), 0, SW_RES(STR_THREE), 0 ); 56ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_LEFT_L), 0, SW_RES(STR_LEFT), 0 ); 57ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT_L), 0, SW_RES(STR_RIGHT), 0 ); 58ff0525f2SOliver-Rainer Wittmann } 59ff0525f2SOliver-Rainer Wittmann else 60ff0525f2SOliver-Rainer Wittmann { 61ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_ONE), 0, SW_RES(STR_ONE), 0 ); 62ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_TWO), 0, SW_RES(STR_TWO), 0 ); 63ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_THREE), 0, SW_RES(STR_THREE), 0 ); 64ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_LEFT), 0, SW_RES(STR_LEFT), 0 ); 65ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->AddItem( SW_RES(IMG_RIGHT), 0, SW_RES(STR_RIGHT), 0 ); 66ff0525f2SOliver-Rainer Wittmann } 67ff0525f2SOliver-Rainer Wittmann 68ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SetNoSelection(); 69ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SetSelectHdl( LINK(this, PageColumnControl,ImplColumnHdl ) ); 70ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->Show(); 71ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SelectItem( mnColumnType ); 72ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->Format(); 73ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->StartSelection(); 74ff0525f2SOliver-Rainer Wittmann 75ff0525f2SOliver-Rainer Wittmann maMoreButton.SetClickHdl( LINK( this, PageColumnControl, MoreButtonClickHdl_Impl ) ); 76ff0525f2SOliver-Rainer Wittmann maMoreButton.GrabFocus(); 77ff0525f2SOliver-Rainer Wittmann 78ff0525f2SOliver-Rainer Wittmann FreeResource(); 79ff0525f2SOliver-Rainer Wittmann } 80ff0525f2SOliver-Rainer Wittmann 81ff0525f2SOliver-Rainer Wittmann 82ff0525f2SOliver-Rainer Wittmann PageColumnControl::~PageColumnControl(void) 83ff0525f2SOliver-Rainer Wittmann { 84ff0525f2SOliver-Rainer Wittmann delete mpColumnValueSet; 85ff0525f2SOliver-Rainer Wittmann } 86ff0525f2SOliver-Rainer Wittmann 87ff0525f2SOliver-Rainer Wittmann 88ff0525f2SOliver-Rainer Wittmann IMPL_LINK(PageColumnControl, ImplColumnHdl, void *, pControl) 89ff0525f2SOliver-Rainer Wittmann { 90ff0525f2SOliver-Rainer Wittmann mpColumnValueSet->SetNoSelection(); 91ff0525f2SOliver-Rainer Wittmann if ( pControl == mpColumnValueSet ) 92ff0525f2SOliver-Rainer Wittmann { 93ff0525f2SOliver-Rainer Wittmann const sal_uInt32 nColumnType = mpColumnValueSet->GetSelectItemId(); 94ff0525f2SOliver-Rainer Wittmann if ( nColumnType != mnColumnType ) 95ff0525f2SOliver-Rainer Wittmann { 96ff0525f2SOliver-Rainer Wittmann mnColumnType = nColumnType; 97ff0525f2SOliver-Rainer Wittmann mrPagePropPanel.ExecuteColumnChange( mnColumnType ); 98ff0525f2SOliver-Rainer Wittmann } 99ff0525f2SOliver-Rainer Wittmann } 100ff0525f2SOliver-Rainer Wittmann 101ff0525f2SOliver-Rainer Wittmann mrPagePropPanel.ClosePageColumnPopup(); 102ff0525f2SOliver-Rainer Wittmann return 0; 103ff0525f2SOliver-Rainer Wittmann } 104ff0525f2SOliver-Rainer Wittmann 105ff0525f2SOliver-Rainer Wittmann IMPL_LINK(PageColumnControl, MoreButtonClickHdl_Impl, void *, EMPTYARG) 106ff0525f2SOliver-Rainer Wittmann { 107ff0525f2SOliver-Rainer Wittmann mrPagePropPanel.GetBindings()->GetDispatcher()->Execute( FN_FORMAT_PAGE_COLUMN_DLG, SFX_CALLMODE_ASYNCHRON ); 108ff0525f2SOliver-Rainer Wittmann 109ff0525f2SOliver-Rainer Wittmann mrPagePropPanel.ClosePageColumnPopup(); 110ff0525f2SOliver-Rainer Wittmann return 0; 111ff0525f2SOliver-Rainer Wittmann } 112ff0525f2SOliver-Rainer Wittmann 113ff0525f2SOliver-Rainer Wittmann 114ff0525f2SOliver-Rainer Wittmann } } // end of namespace sw::sidebar 115ff0525f2SOliver-Rainer Wittmann 116