fuinsert.cxx (6f0b96b4) fuinsert.cxx (52f1c2ee)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 128 unchanged lines hidden (view full) ---

137 Graphic aGraphic;
138 int nError = aDlg.GetGraphic(aGraphic);
139 if( nError == GRFILTER_OK )
140 {
141 if( mpViewShell && mpViewShell->ISA(DrawViewShell))
142 {
143 sal_Int8 nAction = DND_ACTION_COPY;
144 SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 128 unchanged lines hidden (view full) ---

137 Graphic aGraphic;
138 int nError = aDlg.GetGraphic(aGraphic);
139 if( nError == GRFILTER_OK )
140 {
141 if( mpViewShell && mpViewShell->ISA(DrawViewShell))
142 {
143 sal_Int8 nAction = DND_ACTION_COPY;
144 SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
145 if( pPickObj )
146 nAction = DND_ACTION_LINK;
145 bool bSelectionReplaced(false);
147
146
147 if( pPickObj )
148 {
149 nAction = DND_ACTION_LINK;
150 }
151 else if(1 == mpView->GetMarkedObjectCount())
152 {
153 pPickObj = mpView->GetMarkedObjectByIndex(0);
154 nAction = DND_ACTION_MOVE;
155 bSelectionReplaced = true;
156 }
157
148 Point aPos;
149 Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
150 aPos = aRect.Center();
151 aPos = mpWindow->PixelToLogic(aPos);
152 SdrGrafObj* pGrafObj = mpView->InsertGraphic(aGraphic, nAction, aPos, pPickObj, NULL);
153
154 if(pGrafObj && aDlg.IsAsLink())
155 {
156 // store link only?
157 String aFltName(aDlg.GetCurrentFilter());
158 String aPath(aDlg.GetPath());
159 pGrafObj->SetGraphicLink(aPath, aFltName);
160 }
158 Point aPos;
159 Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
160 aPos = aRect.Center();
161 aPos = mpWindow->PixelToLogic(aPos);
162 SdrGrafObj* pGrafObj = mpView->InsertGraphic(aGraphic, nAction, aPos, pPickObj, NULL);
163
164 if(pGrafObj && aDlg.IsAsLink())
165 {
166 // store link only?
167 String aFltName(aDlg.GetCurrentFilter());
168 String aPath(aDlg.GetPath());
169 pGrafObj->SetGraphicLink(aPath, aFltName);
170 }
171
172 if(bSelectionReplaced && pGrafObj)
173 {
174 mpView->MarkObj(pGrafObj, mpView->GetSdrPageView());
175 }
161 }
162 }
163 else
164 {
165 SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter()->GetLastError().nStreamError );
166 }
167 }
168}

--- 608 unchanged lines hidden ---
176 }
177 }
178 else
179 {
180 SdGRFFilter::HandleGraphicFilterError( (sal_uInt16)nError, GraphicFilter::GetGraphicFilter()->GetLastError().nStreamError );
181 }
182 }
183}

--- 608 unchanged lines hidden ---